Class QueryTermExtractor
Utility class used to extract the terms used in a query, plus any weights. This class will not find terms for Lucene.Net.Search.MultiTermQuery, RangeQuery and Lucene.Net.Search.PrefixQuery classes so the caller must pass a rewritten query (see Lucene.Net.Search.Query.Rewrite(Lucene.Net.Index.IndexReader)) to obtain a list of expanded terms.
Inherited Members
Namespace: Lucene.Net.Search.Highlight
Assembly: Lucene.Net.Highlighter.dll
Syntax
public static class QueryTermExtractor
Methods
GetIdfWeightedTerms(Query, IndexReader, string)
Extracts all terms texts of a given Lucene.Net.Search.Query into an array of WeightedTerms
Declaration
public static WeightedTerm[] GetIdfWeightedTerms(Query query, IndexReader reader, string fieldName)
Parameters
Type | Name | Description |
---|---|---|
Query | query | Lucene.Net.Search.Query to extract term texts from |
IndexReader | reader | used to compute IDF which can be used to a) score selected fragments better b) use graded highlights eg chaning intensity of font color |
string | fieldName | the field on which Inverse Document Frequency (IDF) calculations are based |
Returns
Type | Description |
---|---|
WeightedTerm[] | an array of the terms used in a query, plus their weights. |
GetTerms(Query)
Extracts all terms texts of a given Lucene.Net.Search.Query into an array of WeightedTerms
Declaration
public static WeightedTerm[] GetTerms(Query query)
Parameters
Type | Name | Description |
---|---|---|
Query | query | Lucene.Net.Search.Query to extract term texts from |
Returns
Type | Description |
---|---|
WeightedTerm[] | an array of the terms used in a query, plus their weights. |
GetTerms(Query, bool)
Extracts all terms texts of a given Lucene.Net.Search.Query into an array of WeightedTerms
Declaration
public static WeightedTerm[] GetTerms(Query query, bool prohibited)
Parameters
Type | Name | Description |
---|---|---|
Query | query | Lucene.Net.Search.Query to extract term texts from |
bool | prohibited |
|
Returns
Type | Description |
---|---|
WeightedTerm[] | an array of the terms used in a query, plus their weights. |
GetTerms(Query, bool, string)
Extracts all terms texts of a given Lucene.Net.Search.Query into an array of WeightedTerms
Declaration
public static WeightedTerm[] GetTerms(Query query, bool prohibited, string fieldName)
Parameters
Type | Name | Description |
---|---|---|
Query | query | Lucene.Net.Search.Query to extract term texts from |
bool | prohibited |
|
string | fieldName | The fieldName used to filter query terms |
Returns
Type | Description |
---|---|
WeightedTerm[] | an array of the terms used in a query, plus their weights. |