I'm looking for a way to give words a score (different score for each word) and find docs that match a minimum score (based on the scores and the words).
The idea is that I might have words with high score (wordA - score=5) and I want all docs that has wordA, but I also have words with lower score (wordB, wordC, wordD - score=2). If i want docs that match minimum of score=4 I would like to get the docs that has wordA or any combination of 2 of (wordB, wordC, wordD).
Same goes with minimum score of 6 - the result should be docs contains wordA and one of (wordB, wordC, wordD), or docs contains all 3 of (wordB, wordC, wordD).
I was trying to boost words combined with minimum_should_match, but it doesn't really do the trick. Any ideas of how I can do that?
If you need the explicit scoring (e.g you don't want TF-IDF derived scores), you can use the function_score to set your own custom scoring based on lists of terms and their weightings. For example:
Each filter function contains a terms which includes the list of tokens for a given weight. The function score is then configured to sum up the weights. Then we configure the query to have a minimum score of 3, which excludes documents that haven't accumulated enough "weight".
You could also use the Terms Lookup functionality to index those term lists, instead of specifying them in the query itself
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.