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.
  • Field Details

    • LINEAR_COEF

      protected static double LINEAR_COEF
      Coefficient used for linear blending
    • exponent

      private Double exponent
    • DEFAULT_NUM_FACTOR

      public static int DEFAULT_NUM_FACTOR
      Default factor
    • numFactor

      private final int numFactor
      Factor to multiply the number of searched elements
    • blenderType

      private final BlendedInfixSuggester.BlenderType blenderType
      Type of blender used by the suggester
    • LOOKUP_COMP

      private static Comparator<Lookup.LookupResult> LOOKUP_COMP
  • Constructor Details

    • 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.
  • Method Details