Class QueryScorer
IScorer implementation which scores text fragments by the number of unique query terms found. This class converts appropriate Lucene.Net.Search.Querys to Lucene.Net.Search.Spans.SpanQuerys and attempts to score only those terms that participated in generating the 'hit' on the document.
Inheritance
Implements
Inherited Members
Namespace: Lucene.Net.Search.Highlight
Assembly: Lucene.Net.Highlighter.dll
Syntax
public class QueryScorer : IScorer
Constructors
| Improve this Doc View SourceQueryScorer(WeightedSpanTerm[])
Constructs a new QueryScorer instance
Declaration
public QueryScorer(WeightedSpanTerm[] weightedTerms)
Parameters
Type | Name | Description |
---|---|---|
WeightedSpanTerm[] | weightedTerms | an array of pre-created WeightedSpanTerms |
QueryScorer(Query)
Constructs a new QueryScorer instance
Declaration
public QueryScorer(Query query)
Parameters
Type | Name | Description |
---|---|---|
Lucene.Net.Search.Query | query | Lucene.Net.Search.Query to use for highlighting |
QueryScorer(Query, IndexReader, String)
Constructs a new QueryScorer instance
Declaration
public QueryScorer(Query query, IndexReader reader, string field)
Parameters
Type | Name | Description |
---|---|---|
Lucene.Net.Search.Query | query | Lucene.Net.Search.Query to use for highlighting |
Lucene.Net.Index.IndexReader | reader | Lucene.Net.Index.IndexReader to use for quasi tf/idf scoring |
System.String | field | Field to highlight - pass null to ignore fields |
QueryScorer(Query, IndexReader, String, String)
Constructs a new QueryScorer instance
Declaration
public QueryScorer(Query query, IndexReader reader, string field, string defaultField)
Parameters
Type | Name | Description |
---|---|---|
Lucene.Net.Search.Query | query | Lucene.Net.Search.Query to use for highlighting |
Lucene.Net.Index.IndexReader | reader | Lucene.Net.Index.IndexReader to use for quasi tf/idf scoring |
System.String | field | Field to highlight - pass null to ignore fields |
System.String | defaultField | The default field for queries with the field name unspecified |
QueryScorer(Query, String)
Constructs a new QueryScorer instance
Declaration
public QueryScorer(Query query, string field)
Parameters
Type | Name | Description |
---|---|---|
Lucene.Net.Search.Query | query | Lucene.Net.Search.Query to use for highlighting |
System.String | field | Field to highlight - pass null to ignore fields |
QueryScorer(Query, String, String)
Constructs a new QueryScorer instance
Declaration
public QueryScorer(Query query, string field, string defaultField)
Parameters
Type | Name | Description |
---|---|---|
Lucene.Net.Search.Query | query | Lucene.Net.Search.Query to use for highlighting |
System.String | field | Field to highlight - pass null to ignore fields |
System.String | defaultField | The default field for queries with the field name unspecified |
Properties
| Improve this Doc View SourceExpandMultiTermQuery
Controls whether or not multi-term queries are expanded
against a Lucene.Net.Index.Memory.MemoryIndex Lucene.Net.Index.IndexReader.
true
if multi-term queries should be expanded
Declaration
public virtual bool ExpandMultiTermQuery { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
FragmentScore
Declaration
public virtual float FragmentScore { get; }
Property Value
Type | Description |
---|---|
System.Single |
See Also
| Improve this Doc View SourceMaxTermWeight
The highest weighted term (useful for passing to GradientFormatter to set top end of coloring scale).
Declaration
public virtual float MaxTermWeight { get; }
Property Value
Type | Description |
---|---|
System.Single |
Methods
| Improve this Doc View SourceGetTokenScore()
Declaration
public virtual float GetTokenScore()
Returns
Type | Description |
---|---|
System.Single |
See Also
| Improve this Doc View SourceGetWeightedSpanTerm(String)
Retrieve the WeightedSpanTerm for the specified token. Useful for passing Span information to a IFragmenter.
Declaration
public virtual WeightedSpanTerm GetWeightedSpanTerm(string token)
Parameters
Type | Name | Description |
---|---|---|
System.String | token | token to get WeightedSpanTerm for |
Returns
Type | Description |
---|---|
WeightedSpanTerm | WeightedSpanTerm for token |
Init(TokenStream)
Declaration
public virtual TokenStream Init(TokenStream tokenStream)
Parameters
Type | Name | Description |
---|---|---|
Lucene.Net.Analysis.TokenStream | tokenStream |
Returns
Type | Description |
---|---|
Lucene.Net.Analysis.TokenStream |
See Also
NewTermExtractor(String)
Declaration
protected virtual WeightedSpanTermExtractor NewTermExtractor(string defaultField)
Parameters
Type | Name | Description |
---|---|---|
System.String | defaultField |
Returns
Type | Description |
---|---|
WeightedSpanTermExtractor |
SetMaxDocCharsToAnalyze(Int32)
Declaration
public virtual void SetMaxDocCharsToAnalyze(int maxDocCharsToAnalyze)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | maxDocCharsToAnalyze |
SetWrapIfNotCachingTokenFilter(Boolean)
By default, Lucene.Net.Analysis.TokenStreams that are not of the type Lucene.Net.Analysis.CachingTokenFilter are wrapped in a Lucene.Net.Analysis.CachingTokenFilter to ensure an efficient reset - if you are already using a different caching Lucene.Net.Analysis.TokenStream impl and you don't want it to be wrapped, set this to false.
Declaration
public virtual void SetWrapIfNotCachingTokenFilter(bool wrap)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | wrap |
StartFragment(TextFragment)
Declaration
public virtual void StartFragment(TextFragment newFragment)
Parameters
Type | Name | Description |
---|---|---|
TextFragment | newFragment |