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.
|
Query that sets document score as a programmatic function of several (sub) scores:
Subclasses can modify the computation by overriding GetCustomScoreProvider. More...
Inherits Lucene.Net.Search.Query, and ICloneable.
Public Member Functions | |
CustomScoreQuery (Query subQuery) | |
Create a CustomScoreQuery over input subQuery. | |
CustomScoreQuery (Query subQuery, ValueSourceQuery valSrcQuery) | |
Create a CustomScoreQuery over input subQuery and a ValueSourceQuery. | |
override Query | Rewrite (IndexReader reader) |
Expert: called to re-write queries into primitive queries. For example, a PrefixQuery will be rewritten into a BooleanQuery that consists of TermQuerys. | |
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.Object | Clone () |
Returns a clone of this query. | |
override System.String | ToString (System.String field) |
Prints a query to a string, with field assumed to be the default field and omitted. The representation used is one that is supposed to be readable by QueryParser. However, there are the following limitations:
| |
override bool | Equals (System.Object o) |
Returns true if o is equal to this. | |
override int | GetHashCode () |
Returns a hash code value for this object. | |
virtual float | CustomScore (int doc, float subQueryScore, float[] valSrcScores) |
Compute a custom score by the subQuery score and a number of ValueSourceQuery scores. | |
virtual float | CustomScore (int doc, float subQueryScore, float valSrcScore) |
Compute a custom score by the subQuery score and the ValueSourceQuery score. | |
virtual Explanation | CustomExplain (int doc, Explanation subQueryExpl, Explanation[] valSrcExpls) |
Explain the custom score. | |
virtual Explanation | CustomExplain (int doc, Explanation subQueryExpl, Explanation valSrcExpl) |
Explain the custom score. The doc is relative to the current reader, which is unknown to CustomScoreQuery when using per-segment search (since Lucene 2.9). Please override GetCustomScoreProvider and return a subclass of CustomScoreProvider for the given IndexReader. | |
override Weight | CreateWeight (Searcher searcher) |
Expert: Constructs an appropriate Weight implementation for this query. | |
virtual bool | IsStrict () |
Checks if this is strict custom scoring. In strict custom scoring, the ValueSource part does not participate in weight normalization. This may be useful when one wants full control over how scores are modified, and does not care about normalizing by the ValueSource part. One particular case where this is useful if for testing this query. Note: only has effect when the ValueSource part is not null. | |
virtual void | SetStrict (bool strict) |
Set the strict mode of this query. | |
virtual System.String | Name () |
A short name of this query, used in ToString(String). | |
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) |
Protected Member Functions | |
virtual CustomScoreProvider | GetCustomScoreProvider (IndexReader reader) |
Returns a CustomScoreProvider that calculates the custom scores for the given IndexReader. The default implementation returns a default implementation as specified in the docs of CustomScoreProvider. | |
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. | |
Query that sets document score as a programmatic function of several (sub) scores:
Subclasses can modify the computation by overriding GetCustomScoreProvider.
<font color="#FF0000"> WARNING: The status of the Search.Function package is experimental. The APIs introduced here might change in the future and will not be supported anymore in such a case.</font>
Definition at line 49 of file CustomScoreQuery.cs.
Lucene.Net.Search.Function.CustomScoreQuery.CustomScoreQuery | ( | Query | subQuery | ) |
Create a CustomScoreQuery over input subQuery.
subQuery | the sub query whose scored is being customed. Must not be null. |
Definition at line 59 of file CustomScoreQuery.cs.
Lucene.Net.Search.Function.CustomScoreQuery.CustomScoreQuery | ( | Query | subQuery, |
ValueSourceQuery | valSrcQuery | ||
) |
Create a CustomScoreQuery over input subQuery and a ValueSourceQuery.
subQuery | the sub query whose score is being customed. Must not be null. |
valSrcQuery | a value source query whose scores are used in the custom score computation. For most simple/convineient use case this would be a FieldScoreQuery. This parameter is optional - it can be null or even an empty array. |
Definition at line 71 of file CustomScoreQuery.cs.
|
virtual |
Returns a clone of this query.
Reimplemented from Lucene.Net.Search.Query.
Definition at line 127 of file CustomScoreQuery.cs.
|
virtual |
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 545 of file CustomScoreQuery.cs.
|
virtual |
Explain the custom score.
The doc is relative to the current reader, which is unknown to CustomScoreQuery when using per-segment search (since Lucene 2.9). Please override GetCustomScoreProvider(IndexReader) and return a subclass of CustomScoreProvider for the given IndexReader.
Definition at line 279 of file CustomScoreQuery.cs.
|
virtual |
Explain the custom score. The doc is relative to the current reader, which is unknown to CustomScoreQuery when using per-segment search (since Lucene 2.9). Please override GetCustomScoreProvider and return a subclass of CustomScoreProvider for the given IndexReader.
Definition at line 310 of file CustomScoreQuery.cs.
|
virtual |
Compute a custom score by the subQuery score and a number of ValueSourceQuery scores.
The doc is relative to the current reader, which is unknown to CustomScoreQuery when using per-segment search (since Lucene 2.9). Please override GetCustomScoreProvider and return a subclass of CustomScoreProvider for the given IndexReader. see CustomScoreProvider::customScore(int,float,float[])
Definition at line 237 of file CustomScoreQuery.cs.
|
virtual |
Compute a custom score by the subQuery score and the ValueSourceQuery score.
The doc is relative to the current reader, which is unknown to CustomScoreQuery when using per-segment search (since Lucene 2.9). Please override GetCustomScoreProvider and return a subclass of CustomScoreProvider for the given IndexReader.
Definition at line 264 of file CustomScoreQuery.cs.
override bool Lucene.Net.Search.Function.CustomScoreQuery.Equals | ( | System.Object | o | ) |
Returns true if o
is equal to this.
Definition at line 154 of file CustomScoreQuery.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 117 of file CustomScoreQuery.cs.
|
protectedvirtual |
Returns a CustomScoreProvider that calculates the custom scores for the given IndexReader. The default implementation returns a default implementation as specified in the docs of CustomScoreProvider.
Definition at line 192 of file CustomScoreQuery.cs.
override int Lucene.Net.Search.Function.CustomScoreQuery.GetHashCode | ( | ) |
Returns a hash code value for this object.
Definition at line 174 of file CustomScoreQuery.cs.
|
virtual |
Checks if this is strict custom scoring. In strict custom scoring, the ValueSource part does not participate in weight normalization. This may be useful when one wants full control over how scores are modified, and does not care about normalizing by the ValueSource part. One particular case where this is useful if for testing this query. Note: only has effect when the ValueSource part is not null.
Definition at line 558 of file CustomScoreQuery.cs.
|
virtual |
A short name of this query, used in ToString(String).
Definition at line 574 of file CustomScoreQuery.cs.
|
virtual |
Expert: called to re-write queries into primitive queries. For example, a PrefixQuery will be rewritten into a BooleanQuery that consists of TermQuerys.
Reimplemented from Lucene.Net.Search.Query.
Definition at line 92 of file CustomScoreQuery.cs.
|
virtual |
Set the strict mode of this query.
strict | The strict mode to set. |
Definition at line 568 of file CustomScoreQuery.cs.
|
virtual |
Prints a query to a string, with field
assumed to be the default field and omitted. The representation used is one that is supposed to be readable by QueryParser. However, there are the following limitations:
Implements Lucene.Net.Search.Query.
Definition at line 140 of file CustomScoreQuery.cs.