Class BlendedInfixSuggester

  • All Implemented Interfaces:
    Closeable, AutoCloseable, Accountable

    public class BlendedInfixSuggester
    extends AnalyzingInfixSuggester
    Extension of the AnalyzingInfixSuggester which transforms the weight after search to take into account the position of the searched term into the indexed text. Please note that it increases the number of elements searched and applies the ponderation after. It might be costly for long suggestions.
    WARNING: This API is experimental and might change in incompatible ways in the next release.
    • Field Detail

      • LINEAR_COEF

        protected static double LINEAR_COEF
        Coefficient used for linear blending
      • DEFAULT_NUM_FACTOR

        public static int DEFAULT_NUM_FACTOR
        Default factor
    • Constructor Detail

      • BlendedInfixSuggester

        public BlendedInfixSuggester​(Directory dir,
                                     Analyzer analyzer)
                              throws IOException
        Create a new instance, loading from a previously built directory, if it exists.
        Throws:
        IOException
      • BlendedInfixSuggester

        public BlendedInfixSuggester​(Directory dir,
                                     Analyzer indexAnalyzer,
                                     Analyzer queryAnalyzer,
                                     int minPrefixChars,
                                     BlendedInfixSuggester.BlenderType blenderType,
                                     int numFactor,
                                     boolean commitOnBuild)
                              throws IOException
        Create a new instance, loading from a previously built directory, if it exists.
        Parameters:
        blenderType - Type of blending strategy, see BlenderType for more precisions
        numFactor - Factor to multiply the number of searched elements before ponderate
        commitOnBuild - Call commit after the index has finished building. This would persist the suggester index to disk and future instances of this suggester can use this pre-built dictionary.
        Throws:
        IOException - If there are problems opening the underlying Lucene index.
      • BlendedInfixSuggester

        public BlendedInfixSuggester​(Directory dir,
                                     Analyzer indexAnalyzer,
                                     Analyzer queryAnalyzer,
                                     int minPrefixChars,
                                     BlendedInfixSuggester.BlenderType blenderType,
                                     int numFactor,
                                     Double exponent,
                                     boolean commitOnBuild,
                                     boolean allTermsRequired,
                                     boolean highlight)
                              throws IOException
        Create a new instance, loading from a previously built directory, if it exists.
        Parameters:
        blenderType - Type of blending strategy, see BlenderType for more precisions
        numFactor - Factor to multiply the number of searched elements before ponderate
        exponent - exponent used only when blenderType is BlenderType.POSITION_EXPONENTIAL_RECIPROCAL
        commitOnBuild - Call commit after the index has finished building. This would persist the suggester index to disk and future instances of this suggester can use this pre-built dictionary.
        allTermsRequired - All terms in the suggest query must be matched.
        highlight - Highlight suggest query in suggestions.
        Throws:
        IOException - If there are problems opening the underlying Lucene index.