Class MultiTermQuery
An abstract Query that matches documents
containing a subset of terms provided by a
Filtered
This query cannot be used directly; you must subclass
it and define Get
NOTE: if Multi
The recommended rewrite method is
CONSTANT_SCORE_AUTO_REWRITE_DEFAULT: it doesn't spend CPU
computing unhelpful scores, and it tries to pick the most
performant rewrite method given the query. If you
need scoring (like
Note that QueryParsers.Classic.QueryParser produces
Multi
Inheritance
Inherited Members
Namespace: Lucene.Net.Search
Assembly: Lucene.Net.dll
Syntax
public abstract class MultiTermQuery : Query
Constructors
| Improve this Doc View SourceMultiTermQuery(String)
Constructs a query matching terms that cannot be represented with a single Term.
Declaration
public MultiTermQuery(string field)
Parameters
Type | Name | Description |
---|---|---|
System. |
field |
Fields
| Improve this Doc View SourceCONSTANT_SCORE_AUTO_REWRITE_DEFAULT
Read-only default instance of
Constant
Declaration
public static readonly MultiTermQuery.RewriteMethod CONSTANT_SCORE_AUTO_REWRITE_DEFAULT
Field Value
Type | Description |
---|---|
Multi |
CONSTANT_SCORE_BOOLEAN_QUERY_REWRITE
Like SCORING_BOOLEAN_QUERY_REWRITE except scores are not computed. Instead, each matching document receives a constant score equal to the query's boost.
NOTE: this rewrite method will hit
Boolean
Declaration
public static readonly MultiTermQuery.RewriteMethod CONSTANT_SCORE_BOOLEAN_QUERY_REWRITE
Field Value
Type | Description |
---|---|
Multi |
See Also
| Improve this Doc View SourceCONSTANT_SCORE_FILTER_REWRITE
A rewrite method that first creates a private Filter, by visiting each term in sequence and marking all docs for that term. Matching documents are assigned a constant score equal to the query's boost.
This method is faster than the Boolean
Declaration
public static readonly MultiTermQuery.RewriteMethod CONSTANT_SCORE_FILTER_REWRITE
Field Value
Type | Description |
---|---|
Multi |
See Also
| Improve this Doc View Sourcem_field
Declaration
protected readonly string m_field
Field Value
Type | Description |
---|---|
System. |
m_rewriteMethod
Declaration
protected MultiTermQuery.RewriteMethod m_rewriteMethod
Field Value
Type | Description |
---|---|
Multi |
SCORING_BOOLEAN_QUERY_REWRITE
A rewrite method that first translates each term into
SHOULD clause in a
Boolean
NOTE: this rewrite method will hit
Boolean
Declaration
public static readonly MultiTermQuery.RewriteMethod SCORING_BOOLEAN_QUERY_REWRITE
Field Value
Type | Description |
---|---|
Multi |
See Also
Properties
| Improve this Doc View SourceField
Returns the field name for this query
Declaration
public string Field { get; }
Property Value
Type | Description |
---|---|
System. |
MultiTermRewriteMethod
Gets or Sets the rewrite method to be used when executing the
query. You can use one of the four core methods, or
implement your own subclass of Multi
Declaration
public virtual MultiTermQuery.RewriteMethod MultiTermRewriteMethod { get; set; }
Property Value
Type | Description |
---|---|
Multi |
Methods
| Improve this Doc View SourceEquals(Object)
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
System. |
obj |
Returns
Type | Description |
---|---|
System. |
Overrides
| Improve this Doc View SourceGetHashCode()
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
System. |
Overrides
| Improve this Doc View SourceGetTermsEnum(Terms)
Convenience method, if no attributes are needed: this simply passes empty attributes and is equal to:
GetTermsEnum(terms, new AttributeSource())
Declaration
public TermsEnum GetTermsEnum(Terms terms)
Parameters
Type | Name | Description |
---|---|---|
Terms | terms |
Returns
Type | Description |
---|---|
Terms |
GetTermsEnum(Terms, AttributeSource)
Construct the enumeration to be used, expanding the
pattern term. this method should only be called if
the field exists (ie, implementations can assume the
field does exist). this method should not return null
(should instead return EMPTY if no
terms match). The Terms
Declaration
protected abstract TermsEnum GetTermsEnum(Terms terms, AttributeSource atts)
Parameters
Type | Name | Description |
---|---|---|
Terms | terms | |
Attribute |
atts |
Returns
Type | Description |
---|---|
Terms |
Rewrite(IndexReader)
To rewrite to a simpler form, instead return a simpler
enum from Get
Declaration
public override sealed Query Rewrite(IndexReader reader)
Parameters
Type | Name | Description |
---|---|---|
Index |
reader |
Returns
Type | Description |
---|---|
Query |