Class DidYouMeanIndexer


  • public class DidYouMeanIndexer
    extends Object
    This class allows to manage the specific index of "did you mean" functionality.
    creates new entry into index
    clear all the entries from index
    • Method Detail

      • createSpellIndex

        public static void createSpellIndex​(String field,
                                            String originalIndexDirectory,
                                            String spellIndexDirectory)
        creates or updates a spelling index. The spelling index is created or updated from an existing index. The spelling index is used to suggest words when an user executes a query that returns unsatisfactory results. if a spelling index already exists, only the new words contained in the index source will be added. otherwise a new index will be created
        Parameters:
        field - name of the field of the index source that will be used to feed the spelling index
        originalIndexDirectory - represents the source index path
        spellIndexDirectory - represents the spelling index path
      • createSpellIndex

        public static void createSpellIndex​(String field,
                                            String originalIndexDirectory)
        creates or updates a spelling index. The spelling index is created or updated from an existing index. The spelling index is used to suggest words when an user executes a query that returns unsatisfactory results. if a spelling index already exists, only the new words contained in the index source will be added. otherwise a new index will be created.
        This method create an spelling index from the original index path by the adding a suffix to the original path index. The suffix is already the same
        Parameters:
        field - name of the field of the index source that will be used to feed the spelling index
        originalIndexDirectory - represents the source index path
        See Also:
        DidYouMeanIndexer
      • clearSpellIndex

        public static boolean clearSpellIndex​(String pathSpellChecker)
        Clears all the entries from given spelling index
        Parameters:
        pathSpellChecker - The SpellChecker's path to clear. The path must be a directory path.
        Returns:
        true whether the index have been cleared otherwise false.
      • clearSpellIndex

        public static void clearSpellIndex​(String[] paths)
        Allows to empty several indexes at once. if the operation fails for an index, it will continue for the other indexes
        Parameters:
        paths - array of index path. List of index path to empty
      • createSpellIndexForAllLanguage

        public static void createSpellIndexForAllLanguage​(String field,
                                                          String originalIndexDirectory)
        Tries to creates or updates a spelling index for all language manage by the application instance.
        The spelling index is created or updated from an existing index. The spelling index is used to suggest words when an user executes a query that returns unsatisfactory results. if a spelling index already exists, only the new words contained in the index source will be added. otherwise a new index will be created.
        This method create an spelling index from the original index path by the adding a suffix to the original path index. The suffix is already the same
        Parameters:
        field - name of the field of the index source that will be used to feed the spelling index
        originalIndexDirectory - represents the source index path
        See Also:
        DidYouMeanIndexer