Lucene.Net
3.0.3
Lucene.Net is a port of the Lucene search engine library, written in C# and targeted at .NET runtime users.
|
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. More...
Inherits Lucene.Net.Search.Query, IEnumerable< Query >, and ICloneable.
Classes | |
class | DisjunctionMaxWeight |
Expert: the Weight for DisjunctionMaxQuery, used to normalize, score and explain these queries. | |
Public Member Functions | |
DisjunctionMaxQuery (float tieBreakerMultiplier) | |
Creates a new empty DisjunctionMaxQuery. Use add() to add the subqueries. | |
DisjunctionMaxQuery (System.Collections.Generic.ICollection< Query > disjuncts, float tieBreakerMultiplier) | |
Creates a new DisjunctionMaxQuery | |
virtual void | Add (Query query) |
Add a subquery to this disjunction | |
virtual void | Add (System.Collections.Generic.ICollection< Query > disjuncts) |
Add a collection of disjuncts to this disjunction via Iterable | |
virtual System.Collections.Generic.IEnumerator < Query > | GetEnumerator () |
An Iterator<Query> over the disjuncts | |
override Weight | CreateWeight (Searcher searcher) |
Expert: Constructs an appropriate Weight implementation for this query. | |
override Query | Rewrite (IndexReader reader) |
Optimize our representation and our subqueries representations | |
override System.Object | Clone () |
Create a shallow copy of us – used in rewriting if necessary | |
override void | ExtractTerms (System.Collections.Generic.ISet< Term > terms) |
Expert: adds all terms occuring in this query to the terms set. Only works if this query is in its rewritten form. | |
override System.String | ToString (System.String field) |
Prettyprint us. | |
override bool | Equals (System.Object o) |
Return true iff we represent the same query as o | |
override int | GetHashCode () |
Compute a hash code for hashing us | |
Public Member Functions inherited from Lucene.Net.Search.Query | |
override System.String | ToString () |
Prints a query to a string. | |
virtual Weight | Weight (Searcher searcher) |
Expert: Constructs and initializes a Weight for a top-level query. | |
virtual Query | Combine (Query[] queries) |
Expert: called when re-writing queries under MultiSearcher. | |
virtual Similarity | GetSimilarity (Searcher searcher) |
Expert: Returns the Similarity implementation to be used for this query. Subclasses may override this method to specify their own Similarity implementation, perhaps one that delegates through that of the Searcher. By default the Searcher's Similarity implementation is returned. | |
override int | GetHashCode () |
override bool | Equals (System.Object obj) |
Additional Inherited Members | |
Static Public Member Functions inherited from Lucene.Net.Search.Query | |
static Query | MergeBooleanQueries (params BooleanQuery[] queries) |
Expert: merges the clauses of a set of BooleanQuery's into a single BooleanQuery. | |
Properties inherited from Lucene.Net.Search.Query | |
virtual float | Boost [get, set] |
Gets or sets the boost for this query clause to b . Documents matching this clause will (in addition to the normal weightings) have their score multiplied by b . The boost is 1.0 by default. | |
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.
Definition at line 40 of file DisjunctionMaxQuery.cs.
Lucene.Net.Search.DisjunctionMaxQuery.DisjunctionMaxQuery | ( | float | tieBreakerMultiplier | ) |
Creates a new empty DisjunctionMaxQuery. Use add() to add the subqueries.
tieBreakerMultiplier | the score of each non-maximum disjunct for a document is multiplied by this weight and added into the final score. If non-zero, the value should be small, on the order of 0.1, which says that 10 occurrences of word in a lower-scored field that is also in a higher scored field is just as good as a unique word in the lower scored field (i.e., one that is not in any higher scored field. |
Definition at line 55 of file DisjunctionMaxQuery.cs.
Lucene.Net.Search.DisjunctionMaxQuery.DisjunctionMaxQuery | ( | System.Collections.Generic.ICollection< Query > | disjuncts, |
float | tieBreakerMultiplier | ||
) |
Creates a new DisjunctionMaxQuery
disjuncts | a Collection<Query> of all the disjuncts to add |
tieBreakerMultiplier | the weight to give to each matching non-maximum disjunct |
Definition at line 65 of file DisjunctionMaxQuery.cs.
|
virtual |
Add a subquery to this disjunction
query | the disjunct added |
Definition at line 74 of file DisjunctionMaxQuery.cs.
|
virtual |
Add a collection of disjuncts to this disjunction via Iterable
Definition at line 82 of file DisjunctionMaxQuery.cs.
|
virtual |
Create a shallow copy of us – used in rewriting if necessary
Reimplemented from Lucene.Net.Search.Query.
Definition at line 268 of file DisjunctionMaxQuery.cs.
Expert: Constructs an appropriate Weight implementation for this query.
Only implemented by primitive queries, which re-write to themselves.
Reimplemented from Lucene.Net.Search.Query.
Definition at line 222 of file DisjunctionMaxQuery.cs.
override bool Lucene.Net.Search.DisjunctionMaxQuery.Equals | ( | System.Object | o | ) |
Return true iff we represent the same query as o
o | another object |
Definition at line 328 of file DisjunctionMaxQuery.cs.
|
virtual |
Expert: adds all terms occuring in this query to the terms set. Only works if this query is in its rewritten form.
<throws> UnsupportedOperationException if this query is not yet rewritten </throws>
Reimplemented from Lucene.Net.Search.Query.
Definition at line 276 of file DisjunctionMaxQuery.cs.
|
virtual |
An Iterator<Query> over the disjuncts
Definition at line 88 of file DisjunctionMaxQuery.cs.
override int Lucene.Net.Search.DisjunctionMaxQuery.GetHashCode | ( | ) |
Compute a hash code for hashing us
Definition at line 339 of file DisjunctionMaxQuery.cs.
|
virtual |
Optimize our representation and our subqueries representations
reader | the IndexReader we query |
Reimplemented from Lucene.Net.Search.Query.
Definition at line 232 of file DisjunctionMaxQuery.cs.
|
virtual |
Prettyprint us.
field | the field to which we are applied |
Implements Lucene.Net.Search.Query.
Definition at line 289 of file DisjunctionMaxQuery.cs.