Package org.codelibs.fess.dict
Class DictionaryCreator
java.lang.Object
org.codelibs.fess.dict.DictionaryCreator
- Direct Known Subclasses:
CharMappingCreator,KuromojiCreator,ProtwordsCreator,StemmerOverrideCreator,StopwordsCreator,SynonymCreator
Abstract base class for creating dictionary files from file paths.
Dictionary creators are responsible for recognizing specific file patterns
and creating appropriate DictionaryFile instances for them.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected DictionaryManagerManager for dictionary operations and lifecycle.protected PatternPattern used to match file paths that this creator can handle. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedDictionaryCreator(String pattern) Creates a new DictionaryCreator with the specified pattern. -
Method Summary
Modifier and TypeMethodDescriptionDictionaryFile<? extends DictionaryItem> Creates a dictionary file for the given path and timestamp if it matches this creator's pattern.protected StringencodePath(String path) Encodes a file path using Base64 URL-safe encoding.protected booleanChecks if the given path matches this creator's pattern.protected abstract DictionaryFile<? extends DictionaryItem> newDictionaryFile(String id, String path, Date timestamp) Creates a new dictionary file instance for the given parameters.voidsetDictionaryManager(DictionaryManager dictionaryManager) Sets the dictionary manager for this creator.
-
Field Details
-
pattern
Pattern used to match file paths that this creator can handle. -
dictionaryManager
Manager for dictionary operations and lifecycle.
-
-
Constructor Details
-
DictionaryCreator
Creates a new DictionaryCreator with the specified pattern.- Parameters:
pattern- the regular expression pattern to match file paths
-
-
Method Details
-
create
Creates a dictionary file for the given path and timestamp if it matches this creator's pattern.- Parameters:
path- the file path to create a dictionary file fortimestamp- the timestamp of the dictionary file- Returns:
- a DictionaryFile instance if the path matches, null otherwise
-
encodePath
Encodes a file path using Base64 URL-safe encoding.- Parameters:
path- the file path to encode- Returns:
- the Base64 encoded path
-
isTarget
Checks if the given path matches this creator's pattern.- Parameters:
path- the file path to check- Returns:
- true if the path matches the pattern, false otherwise
-
newDictionaryFile
protected abstract DictionaryFile<? extends DictionaryItem> newDictionaryFile(String id, String path, Date timestamp) Creates a new dictionary file instance for the given parameters.- Parameters:
id- the encoded identifier for the dictionary filepath- the file path of the dictionarytimestamp- the timestamp of the dictionary file- Returns:
- a new DictionaryFile instance
-
setDictionaryManager
Sets the dictionary manager for this creator.- Parameters:
dictionaryManager- the dictionary manager to set
-