Fork me on GitHub
  • API

    Show / Hide Table of Contents

    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
    object
    QueryTermExtractor
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    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

    true to extract "prohibited" terms, too

    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

    true to extract "prohibited" terms, too

    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.

    Back to top Copyright © 2024 The Apache Software Foundation, Licensed under the Apache License, Version 2.0
    Apache Lucene.Net, Lucene.Net, Apache, the Apache feather logo, and the Apache Lucene.Net project logo are trademarks of The Apache Software Foundation.
    All other marks mentioned may be trademarks or registered trademarks of their respective owners.