I have a query that uses a linear decay that operates on year. It applies the decay for each year from the origin, 2017 plus and offset of 4. For older documents decay is probably whittling the score down near zero. While this is ok, if there is an exact match_phrase for a specific field I'd like to still see the document. Changing the boost's does not seem to have effect when the document carry's a year value that is sixteen years in the past.
I'm looking for some suggestions in how we may keep our decay but still get exact matches at the top of the results. Any thoughts?
You could use multiple functions and have a special boost for exact match. The function score query accepts an array of functions so it should be possible to have two queries, one that work with a decay factor and that match document with boolean logic only (terms are ANDed for instance) and one with a match_phrase query that simply boost the score so that exact match rank first ?
It sounds like you are suggesting two queries, one with the decay in the function_score and one without. I am already using multiple functions in the function score so I am assuming that you mean two queries with similar finction_score's but the one with the phrase match does not contain the decay...Is that correct?
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.