Class MultiTermQuery.TopTermsScoringBooleanQueryRewrite

  • Enclosing class:

    public static final class MultiTermQuery.TopTermsScoringBooleanQueryRewrite
    extends TopTermsRewrite<BooleanQuery.Builder>
    A rewrite method that first translates each term into BooleanClause.Occur.SHOULD clause in a BooleanQuery, and keeps the scores as computed by the query.

    This rewrite method only uses the top scoring terms so it will not overflow the boolean max clause count.

    • Constructor Detail

      • TopTermsScoringBooleanQueryRewrite

        public TopTermsScoringBooleanQueryRewrite​(int size)
        Create a TopTermsScoringBooleanQueryRewrite for at most size terms.

        NOTE: if IndexSearcher.getMaxClauseCount() is smaller than size, then it will be used instead.

    • Method Detail

      • getTopLevelBuilder

        protected BooleanQuery.Builder getTopLevelBuilder()
        Return a suitable builder for the top-level Query for holding all expanded terms.
      • addClause

        protected final void addClause​(B topLevel,
                                       Term term,
                                       int docCount,
                                       float boost)
                                throws IOException
        Add a MultiTermQuery term to the top-level query builder.