Class Weight
Expert: Calculate query weights and build query scorers.
The purpose of Weight is to ensure searching does not modify a Query, so that a Query instance can be reused.
Index
Atomic
Since Weight creates Scorer instances for a given
Atomic
A Weight is used in the following way:
- A Weight is constructed by a top-level query, given a
Index
Searcher (CreateWeight(Index ).Searcher) - The Get
Value method is called on the Weight to compute the query normalization factor QueryFor Normalization() Norm(Single) of the query clauses contained in the query. - The query normalization factor is passed to Normalize(Single, Single). At this point the weighting is complete.
- A Scorer is constructed by
Get
Scorer(Atomic .Reader Context, IBits)
@since 2.9
Inheritance
Namespace: Lucene.Net.Search
Assembly: Lucene.Net.dll
Syntax
public abstract class Weight : object
Properties
| Improve this Doc View SourceQuery
The query that this concerns.
Declaration
public abstract Query Query { get; }
Property Value
Type | Description |
---|---|
Query |
ScoresDocsOutOfOrder
Returns true if this implementation scores docs only out of order. This
method is used in conjunction with ICollector's
Accepts
NOTE: the default implementation returns false
, i.e.
the Scorer scores documents in-order.
Declaration
public virtual bool ScoresDocsOutOfOrder { get; }
Property Value
Type | Description |
---|---|
System. |
Methods
| Improve this Doc View SourceExplain(AtomicReaderContext, Int32)
An explanation of the score computation for the named document.
Declaration
public abstract Explanation Explain(AtomicReaderContext context, int doc)
Parameters
Type | Name | Description |
---|---|---|
Atomic |
context | The readers context to create the Explanation for. |
System. |
doc | The document's id relative to the given context's reader |
Returns
Type | Description |
---|---|
Explanation | An Explanation for the score |
GetBulkScorer(AtomicReaderContext, Boolean, IBits)
Optional method, to return a Bulk
Declaration
public virtual BulkScorer GetBulkScorer(AtomicReaderContext context, bool scoreDocsInOrder, IBits acceptDocs)
Parameters
Type | Name | Description |
---|---|---|
Atomic |
context | The Atomic |
System. |
scoreDocsInOrder | Specifies whether in-order scoring of documents is required. Note
that if set to |
IBits | acceptDocs | IBits that represent the allowable docs to match (typically deleted docs but possibly filtering other documents) |
Returns
Type | Description |
---|---|
Bulk |
A Bulk |
GetScorer(AtomicReaderContext, IBits)
Returns a Scorer which scores documents in/out-of order according
to scoreDocsInOrder
.
NOTE: even if scoreDocsInOrder
is false
, it is
recommended to check whether the returned Scorer indeed scores
documents out of order (i.e., call Scores
NOTE: null
can be returned if no documents will be scored by this
query.
Declaration
public abstract Scorer GetScorer(AtomicReaderContext context, IBits acceptDocs)
Parameters
Type | Name | Description |
---|---|---|
Atomic |
context | The Atomic |
IBits | acceptDocs | IBits that represent the allowable docs to match (typically deleted docs but possibly filtering other documents) |
Returns
| Improve this Doc View SourceGetValueForNormalization()
The value for normalization of contained query clauses (e.g. sum of squared weights).
Declaration
public abstract float GetValueForNormalization()
Returns
Type | Description |
---|---|
System. |
Normalize(Single, Single)
Assigns the query normalization factor and boost from parent queries to this.
Declaration
public abstract void Normalize(float norm, float topLevelBoost)
Parameters
Type | Name | Description |
---|---|---|
System. |
norm | |
System. |
topLevelBoost |