Class BlendedInfixSuggester

All Implemented Interfaces:
Closeable, AutoCloseable

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

    • DEFAULT_NUM_FACTOR

      public static int DEFAULT_NUM_FACTOR
      Default factor
  • Constructor Details

    • BlendedInfixSuggester

      public BlendedInfixSuggester(Version matchVersion, File indexPath, Analyzer analyzer) throws IOException
      Create a new instance, loading from a previously built directory, if it exists.
      Throws:
      IOException
    • BlendedInfixSuggester

      public BlendedInfixSuggester(Version matchVersion, File indexPath, Analyzer indexAnalyzer, Analyzer queryAnalyzer, int minPrefixChars, BlendedInfixSuggester.BlenderType blenderType, int numFactor) 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
      Throws:
      IOException - If there are problems opening the underlying Lucene index.
  • Method Details

    • lookup

      public List<Lookup.LookupResult> lookup(CharSequence key, boolean onlyMorePopular, int num)
      Description copied from class: Lookup
      Look up a key and return possible completion for this key.
      Overrides:
      lookup in class AnalyzingInfixSuggester
      Parameters:
      key - lookup key. Depending on the implementation this may be a prefix, misspelling, or even infix.
      onlyMorePopular - return only more popular results
      num - maximum number of results to return
      Returns:
      a list of possible completions, with their relative weight (e.g. popularity)
    • lookup

      public List<Lookup.LookupResult> lookup(CharSequence key, int num, boolean allTermsRequired, boolean doHighlight)
      Description copied from class: AnalyzingInfixSuggester
      Retrieve suggestions, specifying whether all terms must match (allTermsRequired) and whether the hits should be highlighted (doHighlight).
      Overrides:
      lookup in class AnalyzingInfixSuggester