Class CustomScoreQuery
Query that sets document score as a programmatic function of several (sub) scores:
- the score of its subQuery (any query)
- (optional) the score of its FunctionQuery (or queries).
Subclasses can modify the computation by overriding
GetCustomScoreProvider(AtomicReaderContext).
Note
This API is experimental and might change in incompatible ways in the next release.
Inheritance
System.Object
Lucene.Net.Search.Query
CustomScoreQuery
Inherited Members
Lucene.Net.Search.Query.Boost
Lucene.Net.Search.Query.ToString()
System.Object.Equals(System.Object, System.Object)
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
Assembly: Lucene.Net.Queries.dll
Syntax
public class CustomScoreQuery : Query
Constructors
|
Improve this Doc
View Source
CustomScoreQuery(Query)
Declaration
public CustomScoreQuery(Query subQuery)
Parameters
Type |
Name |
Description |
Lucene.Net.Search.Query |
subQuery |
the sub query whose scored is being customized. Must not be null .
|
|
Improve this Doc
View Source
CustomScoreQuery(Query, FunctionQuery)
Declaration
public CustomScoreQuery(Query subQuery, FunctionQuery scoringQuery)
Parameters
Type |
Name |
Description |
Lucene.Net.Search.Query |
subQuery |
the sub query whose score is being customized. Must not be null .
|
FunctionQuery |
scoringQuery |
a value source query whose scores are used in the custom score
computation. This parameter is optional - it can be null.
|
|
Improve this Doc
View Source
CustomScoreQuery(Query, FunctionQuery[])
Declaration
public CustomScoreQuery(Query subQuery, params FunctionQuery[] scoringQueries)
Parameters
Type |
Name |
Description |
Lucene.Net.Search.Query |
subQuery |
the sub query whose score is being customized. Must not be null .
|
FunctionQuery[] |
scoringQueries |
value source queries whose scores are used in the custom score
computation. This parameter is optional - it can be null or even an empty array.
|
Properties
|
Improve this Doc
View Source
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
.
Declaration
public virtual bool IsStrict { get; set; }
Property Value
Type |
Description |
System.Boolean |
|
|
Improve this Doc
View Source
Name
Declaration
public virtual string Name { get; }
Property Value
Type |
Description |
System.String |
|
|
Improve this Doc
View Source
ScoringQueries
Declaration
public virtual Query[] ScoringQueries { get; }
Property Value
Type |
Description |
Lucene.Net.Search.Query[] |
|
|
Improve this Doc
View Source
SubQuery
The sub-query that CustomScoreQuery wraps, affecting both the score and which documents match.
Declaration
public virtual Query SubQuery { get; }
Property Value
Type |
Description |
Lucene.Net.Search.Query |
|
Methods
|
Improve this Doc
View Source
Clone()
Lucene.Net.Search.Query.Clone()
Declaration
public override object Clone()
Returns
Type |
Description |
System.Object |
|
Overrides
Lucene.Net.Search.Query.Clone()
|
Improve this Doc
View Source
CreateWeight(IndexSearcher)
Declaration
public override Weight CreateWeight(IndexSearcher searcher)
Parameters
Type |
Name |
Description |
Lucene.Net.Search.IndexSearcher |
searcher |
|
Returns
Type |
Description |
Lucene.Net.Search.Weight |
|
Overrides
Lucene.Net.Search.Query.CreateWeight(Lucene.Net.Search.IndexSearcher)
|
Improve this Doc
View Source
Equals(Object)
Returns true if o
is equal to this.
Declaration
public override bool Equals(object o)
Parameters
Type |
Name |
Description |
System.Object |
o |
|
Returns
Type |
Description |
System.Boolean |
|
Overrides
|
Improve this Doc
View Source
Declaration
public override void ExtractTerms(ISet<Term> terms)
Parameters
Type |
Name |
Description |
System.Collections.Generic.ISet<Lucene.Net.Index.Term> |
terms |
|
Overrides
|
Improve this Doc
View Source
GetCustomScoreProvider(AtomicReaderContext)
Returns a CustomScoreProvider that calculates the custom scores
for the given Lucene.Net.Index.IndexReader. The default implementation returns a default
implementation as specified in the docs of CustomScoreProvider.
@since 2.9.2
Declaration
protected virtual CustomScoreProvider GetCustomScoreProvider(AtomicReaderContext context)
Parameters
Type |
Name |
Description |
Lucene.Net.Index.AtomicReaderContext |
context |
|
Returns
|
Improve this Doc
View Source
GetHashCode()
Returns a hash code value for this object.
Declaration
public override int GetHashCode()
Returns
Type |
Description |
System.Int32 |
|
Overrides
Lucene.Net.Search.Query.GetHashCode()
|
Improve this Doc
View Source
Rewrite(IndexReader)
Lucene.Net.Search.Query.Rewrite(Lucene.Net.Index.IndexReader)
Declaration
public override Query Rewrite(IndexReader reader)
Parameters
Type |
Name |
Description |
Lucene.Net.Index.IndexReader |
reader |
|
Returns
Type |
Description |
Lucene.Net.Search.Query |
|
Overrides
Lucene.Net.Search.Query.Rewrite(Lucene.Net.Index.IndexReader)
|
Improve this Doc
View Source
ToString(String)
Declaration
public override string ToString(string field)
Parameters
Type |
Name |
Description |
System.String |
field |
|
Returns
Type |
Description |
System.String |
|
Overrides