C# Class Lucene.Net.Search.Highlight.QueryTermExtractor

Utility class used to extract the terms used in a query, plus any weights. This class will not find terms for MultiTermQuery, RangeQuery and PrefixQuery classes so the caller must pass a rewritten query (see Query.rewrite) to obtain a list of expanded terms.
Datei anzeigen Open project: synhershko/lucene.net Class Usage Examples

Public Methods

Method Description
GetIdfWeightedTerms ( Query query, IndexReader reader, string fieldName ) : Lucene.Net.Search.Highlight.WeightedTerm[]

Extracts all terms texts of a given Query into an array of WeightedTerms

GetTerms ( Query query ) : Lucene.Net.Search.Highlight.WeightedTerm[]

Extracts all terms texts of a given Query into an array of WeightedTerms

GetTerms ( Query query, bool prohibited ) : Lucene.Net.Search.Highlight.WeightedTerm[]

Extracts all terms texts of a given Query into an array of WeightedTerms

GetTerms ( Query query, bool prohibited, string fieldName ) : Lucene.Net.Search.Highlight.WeightedTerm[]

Extracts all terms texts of a given Query into an array of WeightedTerms

Private Methods

Method Description
GetTerms ( Query query, HashSet terms, bool prohibited, string fieldName ) : void
GetTermsFromBooleanQuery ( BooleanQuery query, HashSet terms, bool prohibited, string fieldName ) : void

extractTerms is currently the only query-independent means of introspecting queries but it only reveals a list of terms for that query - not the boosts each individual term in that query may or may not have. "Container" queries such as BooleanQuery should be unwrapped to get at the boost info held in each child element. Some discussion around this topic here: http://www.gossamer-threads.com/lists/lucene/java-dev/34208?search_string=introspection;#34208 Unfortunately there seemed to be limited interest in requiring all Query objects to implement something common which would allow access to child queries so what follows here are query-specific implementations for accessing embedded query elements.

GetTermsFromFilteredQuery ( FilteredQuery query, HashSet terms, bool prohibited, string fieldName ) : void

Method Details

GetIdfWeightedTerms() public static method

Extracts all terms texts of a given Query into an array of WeightedTerms
public static GetIdfWeightedTerms ( Query query, IndexReader reader, string fieldName ) : Lucene.Net.Search.Highlight.WeightedTerm[]
query Query Query to extract term texts from
reader Lucene.Net.Index.IndexReader used to compute IDF which can be used to a) score selected fragments better /// b) use graded highlights eg chaning intensity of font color
fieldName string the field on which Inverse Document Frequency (IDF) calculations are based
return Lucene.Net.Search.Highlight.WeightedTerm[]

GetTerms() public static method

Extracts all terms texts of a given Query into an array of WeightedTerms
public static GetTerms ( Query query ) : Lucene.Net.Search.Highlight.WeightedTerm[]
query Query Query to extract term texts from ///
return Lucene.Net.Search.Highlight.WeightedTerm[]

GetTerms() public static method

Extracts all terms texts of a given Query into an array of WeightedTerms
public static GetTerms ( Query query, bool prohibited ) : Lucene.Net.Search.Highlight.WeightedTerm[]
query Query Query to extract term texts from ///
prohibited bool true to extract "prohibited" terms, too ///
return Lucene.Net.Search.Highlight.WeightedTerm[]

GetTerms() public static method

Extracts all terms texts of a given Query into an array of WeightedTerms
public static GetTerms ( Query query, bool prohibited, string fieldName ) : Lucene.Net.Search.Highlight.WeightedTerm[]
query Query Query to extract term texts from
prohibited bool true to extract "prohibited" terms, too
fieldName string The fieldName used to filter query terms
return Lucene.Net.Search.Highlight.WeightedTerm[]