I cannot figure out a way to assign higher relevance for the documents based on the order of the searched term in the document field.
For instance, if we search for "egg" in documents: "bagel, egg", "egg, raw, fresh", it should give higher score to the second one, because the word "egg" is first in this document, rather than second as in the other document.
Hi - you can use multiple clauses in a bool query's should array. One clause is a basic position-independent match query and one which expects a match at the beginning [1]. Docs that match both clauses would score highest.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.