Fork me on GitHub
  • API

    Show / Hide Table of Contents

    Class ConstantScoreAutoRewrite

    A rewrite method that tries to pick the best constant-score rewrite method based on term and document counts from the query. If both the number of terms and documents is small enough, then CONSTANT_SCORE_BOOLEAN_QUERY_REWRITE is used. Otherwise, CONSTANT_SCORE_FILTER_REWRITE is used.

    Inheritance
    object
    MultiTermQuery.RewriteMethod
    TermCollectingRewrite<BooleanQuery>
    ConstantScoreAutoRewrite
    Inherited Members
    TermCollectingRewrite<BooleanQuery>.AddClause(BooleanQuery, Term, int, float)
    MultiTermQuery.RewriteMethod.GetTermsEnum(MultiTermQuery, Terms, AttributeSource)
    object.Equals(object, object)
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Lucene.Net.Search
    Assembly: Lucene.Net.dll
    Syntax
    public class ConstantScoreAutoRewrite : TermCollectingRewrite<BooleanQuery>

    Fields

    DEFAULT_DOC_COUNT_PERCENT

    If the query will hit more than 1 in 1000 of the docs in the index (0.1%), the filter method is fastest:

    Declaration
    public static double DEFAULT_DOC_COUNT_PERCENT
    Field Value
    Type Description
    double

    DEFAULT_TERM_COUNT_CUTOFF

    Defaults derived from rough tests with a 20.0 million doc Wikipedia index. With more than 350 terms in the query, the filter method is fastest:

    Declaration
    public static int DEFAULT_TERM_COUNT_CUTOFF
    Field Value
    Type Description
    int

    Properties

    DocCountPercent

    If the number of documents to be visited in the postings exceeds this specified percentage of the MaxDoc for the index, then CONSTANT_SCORE_FILTER_REWRITE is used. Value may be 0.0 to 100.0.

    Declaration
    public virtual double DocCountPercent { get; set; }
    Property Value
    Type Description
    double

    TermCountCutoff

    If the number of terms in this query is equal to or larger than this setting then CONSTANT_SCORE_FILTER_REWRITE is used.

    Declaration
    public virtual int TermCountCutoff { get; set; }
    Property Value
    Type Description
    int

    Methods

    AddClause(BooleanQuery, Term, int, float, TermContext)

    A rewrite method that tries to pick the best constant-score rewrite method based on term and document counts from the query. If both the number of terms and documents is small enough, then CONSTANT_SCORE_BOOLEAN_QUERY_REWRITE is used. Otherwise, CONSTANT_SCORE_FILTER_REWRITE is used.

    Declaration
    protected override void AddClause(BooleanQuery topLevel, Term term, int docFreq, float boost, TermContext states)
    Parameters
    Type Name Description
    BooleanQuery topLevel
    Term term
    int docFreq
    float boost
    TermContext states
    Overrides
    TermCollectingRewrite<BooleanQuery>.AddClause(BooleanQuery, Term, int, float, TermContext)

    Equals(object)

    Determines whether the specified object is equal to the current object.

    Declaration
    public override bool Equals(object obj)
    Parameters
    Type Name Description
    object obj

    The object to compare with the current object.

    Returns
    Type Description
    bool

    true if the specified object is equal to the current object; otherwise, false.

    Overrides
    object.Equals(object)

    GetHashCode()

    Serves as the default hash function.

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    int

    A hash code for the current object.

    Overrides
    object.GetHashCode()

    GetTopLevelQuery()

    Return a suitable top-level Query for holding all expanded terms.

    Declaration
    protected override BooleanQuery GetTopLevelQuery()
    Returns
    Type Description
    BooleanQuery
    Overrides
    TermCollectingRewrite<BooleanQuery>.GetTopLevelQuery()

    Rewrite(IndexReader, MultiTermQuery)

    A rewrite method that tries to pick the best constant-score rewrite method based on term and document counts from the query. If both the number of terms and documents is small enough, then CONSTANT_SCORE_BOOLEAN_QUERY_REWRITE is used. Otherwise, CONSTANT_SCORE_FILTER_REWRITE is used.

    Declaration
    public override Query Rewrite(IndexReader reader, MultiTermQuery query)
    Parameters
    Type Name Description
    IndexReader reader
    MultiTermQuery query
    Returns
    Type Description
    Query
    Overrides
    MultiTermQuery.RewriteMethod.Rewrite(IndexReader, MultiTermQuery)
    Back to top Copyright © 2024 The Apache Software Foundation, Licensed under the Apache License, Version 2.0
    Apache Lucene.Net, Lucene.Net, Apache, the Apache feather logo, and the Apache Lucene.Net project logo are trademarks of The Apache Software Foundation.
    All other marks mentioned may be trademarks or registered trademarks of their respective owners.