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.
Inheritance
Inherited Members
Namespace: Lucene.Net.Search.Highlight
Assembly: Lucene.Net.Highlighter.dll
Syntax
public static class QueryTermExtractor
Methods
| Improve this Doc View SourceGetIdfWeightedTerms(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 |
---|---|---|
Lucene.Net.Search.Query | query | Lucene.Net.Search.Query to extract term texts from |
Lucene.Net.Index.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 |
System.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 |
---|---|---|
Lucene.Net.Search.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, Boolean)
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 |
---|---|---|
Lucene.Net.Search.Query | query | Lucene.Net.Search.Query to extract term texts from |
System.Boolean | prohibited |
|
Returns
Type | Description |
---|---|
WeightedTerm[] | an array of the terms used in a query, plus their weights. |
GetTerms(Query, Boolean, 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 |
---|---|---|
Lucene.Net.Search.Query | query | Lucene.Net.Search.Query to extract term texts from |
System.Boolean | prohibited |
|
System.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. |