Class FunctionScoreQuery

  • All Implemented Interfaces:
    Expandable<SearchQuery>, SearchQuery

    @SearchPrimitive
    public class FunctionScoreQuery
    extends Object
    implements SearchQuery
    v2 primitive query that modifies the wrapped query score of a retrieved document by combining it according to FunctionScoreQuery.BoostMode with an value provided by ScoreFunction.

    E.g. Assuming a document has a field page-rank storing a float value and we want to adjust a document score such that a new score will be original text score _score * ln(1 + page-rank), the the query would be

     <@code
      SearchQuery q = new FunctionScoreQuery(new SiteTextSearchQuery("perplexity"),
                     new FieldValueFactorFunction(new FloatFieldValueSource("page-rank"), 1.0, Modifier.LOG1P),
                     FunctionScoreQuery.BoostMode.SUM);
     >
    
    Since:
    7.0