An instance of the Alphabet class contains types of characters used for indexing. For detailed information on the types of characters, see the Character types page.
The getCharacterType method is used to get the type of a specific character.
To export types of all characters to a file, use the exportDictionary method.
To import types of all characters from a file, use the importDictionary method.
The following example demonstrates the use of methods of the alphabet.
constindexFolder='c:/MyIndex/';constdocumentsFolder='c:/MyDocuments/';// Creating or opening an index from the specified folder
constindex=newgroupdocs.search.Index(indexFolder);// Export the alphabet to a file
constfileName=Utils.OutputPath+'AdvancedUsage/ManagingDictionaries/alphabet/Alphabet.dat';index.getDictionaries().getAlphabet().exportDictionary(fileName);if(index.getDictionaries().getAlphabet().getCount()>0){// Setting a type of all characters to Separator
index.getDictionaries().getAlphabet().clear();}// Import the alphabet from a file
index.getDictionaries().getAlphabet().importDictionary(fileName);if(String(index.getDictionaries().getAlphabet().getCharacterType(java.newChar('-')))!=String(groupdocs.search.CharacterType.Blended)){// Setting a type of hyphen character to Blended
index.getDictionaries().getAlphabet().setRange(java.newArray('char',['-']),groupdocs.search.CharacterType.Blended);}// Indexing documents from the specified folder
index.add(documentsFolder);// Search in the index
constquery='Elliot-Murray-Kynynmound';constresult=index.search(query);
More resources
GitHub examples
You may easily run the code from documentation articles and see the features in action in our GitHub examples: