Show / Hide Table of Contents

    Class FuzzyLikeThisQuery

    Fuzzifies ALL terms provided as strings and then picks the best n differentiating terms. In effect this mixes the behaviour of FuzzyQuery and MoreLikeThis but with special consideration of fuzzy scoring factors. This generally produces good results for queries where users may provide details in a number of fields and have no knowledge of boolean query syntax and also want a degree of fuzzy matching and a fast query.

    For each source term the fuzzy variants are held in a BooleanQuery with no coord factor (because we are not looking for matches on multiple variants in any one doc). Additionally, a specialized TermQuery is used for variants and does not use that variant term's IDF because this would favour rarer terms eg misspellings. Instead, all variants use the same IDF ranking (the one for the source query term) and this is factored into the variant's boost. If the source query term does not exist in the index the average IDF of the variants is used.

    Inheritance
    System.Object
    Query
    FuzzyLikeThisQuery
    Inherited Members
    Query.Boost
    Query.ToString()
    Query.CreateWeight(IndexSearcher)
    Lucene.Net.Search.Query.ExtractTerms(ISet<>)
    Query.Clone()
    Namespace: Lucene.Net.Sandbox.Queries
    Assembly: Lucene.Net.Sandbox.dll
    Syntax
    public class FuzzyLikeThisQuery : Query

    Constructors

    | Improve this Doc View Source

    FuzzyLikeThisQuery(Int32, Analyzer)

    Declaration
    public FuzzyLikeThisQuery(int maxNumTerms, Analyzer analyzer)
    Parameters
    Type Name Description
    System.Int32 maxNumTerms

    The total number of terms clauses that will appear once rewritten as a BooleanQuery

    Analyzer analyzer

    Properties

    | Improve this Doc View Source

    IgnoreTF

    Declaration
    public virtual bool IgnoreTF { get; set; }
    Property Value
    Type Description
    System.Boolean

    Methods

    | Improve this Doc View Source

    AddTerms(String, String, Single, Int32)

    Adds user input for "fuzzification"

    Declaration
    public virtual void AddTerms(string queryString, string fieldName, float minSimilarity, int prefixLength)
    Parameters
    Type Name Description
    System.String queryString

    The string which will be parsed by the analyzer and for which fuzzy variants will be parsed

    System.String fieldName

    The minimum similarity of the term variants (see FuzzyTermsEnum)

    System.Single minSimilarity

    Length of required common prefix on variant terms (see FuzzyTermsEnum)

    System.Int32 prefixLength
    | Improve this Doc View Source

    Equals(Object)

    Declaration
    public override bool Equals(object obj)
    Parameters
    Type Name Description
    System.Object obj
    Returns
    Type Description
    System.Boolean
    | Improve this Doc View Source

    GetHashCode()

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    System.Int32
    Overrides
    Query.GetHashCode()
    | Improve this Doc View Source

    Rewrite(IndexReader)

    Declaration
    public override Query Rewrite(IndexReader reader)
    Parameters
    Type Name Description
    IndexReader reader
    Returns
    Type Description
    Query
    Overrides
    Query.Rewrite(IndexReader)
    | Improve this Doc View Source

    ToString(String)

    (non-Javadoc)

    Declaration
    public override string ToString(string field)
    Parameters
    Type Name Description
    System.String field
    Returns
    Type Description
    System.String
    • Improve this Doc
    • View Source
    Back to top Copyright © 2020 Licensed to the Apache Software Foundation (ASF)