A query that generates the union of documents produced by its subqueries, and that scores each document with the maximum
score for that document as produced by any subquery, plus a tie breaking increment for any additional matching subqueries.
This is useful when searching for a word in multiple fields with different boost factors (so that the fields cannot be
combined equivalently into a single search field). We want the primary score to be the one associated with the highest boost,
not the sum of the field scores (as BooleanQuery would give).
If the query is "albino elephant" this ensures that "albino" matching one field and "elephant" matching
another gets a higher score than "albino" matching both fields.
To get this result, use both BooleanQuery and DisjunctionMaxQuery: for each term a DisjunctionMaxQuery searches for it in
each field, while the set of these DisjunctionMaxQuery's is combined into a BooleanQuery.
The tie breaker capability allows results that include the same term in multiple fields to be judged better than results that
include this term in only the best of those multiple fields, without confusing this with the better case of two different terms
in the multiple fields.
The DisjunctionMaxQuery..::..DisjunctionMaxWeight type exposes the following members.
Constructors
Name | Description | |
---|---|---|
DisjunctionMaxQuery..::..DisjunctionMaxWeight | Initializes a new instance of the DisjunctionMaxQuery..::..DisjunctionMaxWeight class |
Methods
Name | Description | |
---|---|---|
Equals | (Inherited from Object.) | |
Explain | (Overrides Weight..::..Explain(IndexReader, Int32).) | |
Finalize | Allows an Object to attempt to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.) | |
GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) | |
GetQuery | (Overrides Weight..::..GetQuery()()()().) | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
GetValue | (Overrides Weight..::..GetValue()()()().) | |
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |
Normalize | (Overrides Weight..::..Normalize(Single).) | |
Scorer | (Overrides Weight..::..Scorer(IndexReader, Boolean, Boolean).) | |
ScoresDocsOutOfOrder | Returns true iff this implementation scores docs only out of order. This
method is used in conjunction with {@link Collector}'s
{@link Collector#AcceptsDocsOutOfOrder() acceptsDocsOutOfOrder} and
{@link #Scorer(Lucene.Net.Index.IndexReader, boolean, boolean)} to
create a matching {@link Scorer} instance for a given {@link Collector}, or
vice versa.
NOTE: the default implementation returns (Inherited from Weight.)CopyC# false CopyC# Scorer | |
SumOfSquaredWeights | (Overrides Weight..::..SumOfSquaredWeights()()()().) | |
ToString | (Inherited from Object.) |
Fields
Name | Description | |
---|---|---|
similarity | The Similarity implementation. | |
weights | The Weights for our subqueries, in 1-1 correspondence with disjuncts |
Properties
Name | Description | |
---|---|---|
Enclosing_Instance |