Class BlendedInfixSuggester

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.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 Detail

      • DEFAULT_NUM_FACTOR

        public static int DEFAULT_NUM_FACTOR
        Default factor
    • Constructor Detail

      • BlendedInfixSuggester

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

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

      • lookup

        public java.util.List<Lookup.LookupResult> lookup​(java.lang.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 java.util.List<Lookup.LookupResult> lookup​(java.lang.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