Class StemmerOverrideFile
java.lang.Object
org.codelibs.fess.dict.DictionaryFile<StemmerOverrideItem>
org.codelibs.fess.dict.stemmeroverride.StemmerOverrideFile
Manages a dictionary file for stemmer overrides.
This class handles reading, parsing, and updating files that contain
stemmer override rules, where each rule maps an input word to an
output stem. The file format is expected to be `input => output`.
The class provides methods for retrieving, adding, updating, and
deleting stemmer override items, as well as reloading the dictionary
from its source file.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected classAn inner class for updating the stemmer override file.Nested classes/interfaces inherited from class org.codelibs.fess.dict.DictionaryFile
DictionaryFile.PagingList<E> -
Field Summary
Fields inherited from class org.codelibs.fess.dict.DictionaryFile
dictionaryManager, id, path, timestamp -
Constructor Summary
ConstructorsConstructorDescriptionStemmerOverrideFile(String id, String path, Date timestamp) Constructs a new stemmer override file. -
Method Summary
Modifier and TypeMethodDescriptionvoiddelete(StemmerOverrideItem item) Deletes a dictionary item.org.dbflute.optional.OptionalEntity<StemmerOverrideItem> get(long id) Retrieves a dictionary item by its ID.getPath()Gets the file path of this dictionary.Returns the simple name of the dictionary file.getType()Gets the type identifier for this dictionary file.voidinsert(StemmerOverrideItem item) Inserts a new dictionary item.protected voidReloads the stemmer override dictionary from its source file.protected voidreload(StemmerOverrideFile.StemmerOverrideUpdater updater, InputStream in) Reloads the stemmer override dictionary from an input stream.selectList(int offset, int size) Retrieves a paginated list of dictionary items.toString()voidupdate(InputStream in) Updates the dictionary file with content from an input stream.voidupdate(StemmerOverrideItem item) Updates an existing dictionary item.Methods inherited from class org.codelibs.fess.dict.DictionaryFile
getId, getTimestamp, manager, writeOut
-
Constructor Details
-
StemmerOverrideFile
Constructs a new stemmer override file.- Parameters:
id- The unique identifier for this dictionary file.path- The path to the dictionary file.timestamp- The last modified timestamp of the file.
-
-
Method Details
-
getType
Description copied from class:DictionaryFileGets the type identifier for this dictionary file.- Specified by:
getTypein classDictionaryFile<StemmerOverrideItem>- Returns:
- the dictionary type
-
getPath
Description copied from class:DictionaryFileGets the file path of this dictionary.- Overrides:
getPathin classDictionaryFile<StemmerOverrideItem>- Returns:
- the file path
-
get
Description copied from class:DictionaryFileRetrieves a dictionary item by its ID.- Specified by:
getin classDictionaryFile<StemmerOverrideItem>- Parameters:
id- the item ID- Returns:
- an optional containing the item if found
-
selectList
Description copied from class:DictionaryFileRetrieves a paginated list of dictionary items.- Specified by:
selectListin classDictionaryFile<StemmerOverrideItem>- Parameters:
offset- the starting offset for paginationsize- the number of items to retrieve- Returns:
- a paginated list of dictionary items
-
insert
Description copied from class:DictionaryFileInserts a new dictionary item.- Specified by:
insertin classDictionaryFile<StemmerOverrideItem>- Parameters:
item- the item to insert
-
update
Description copied from class:DictionaryFileUpdates an existing dictionary item.- Specified by:
updatein classDictionaryFile<StemmerOverrideItem>- Parameters:
item- the item to update
-
delete
Description copied from class:DictionaryFileDeletes a dictionary item.- Specified by:
deletein classDictionaryFile<StemmerOverrideItem>- Parameters:
item- the item to delete
-
reload
Reloads the stemmer override dictionary from its source file.- Parameters:
updater- An optional updater to apply changes during reload.- Throws:
DictionaryException- if the dictionary file cannot be read.
-
reload
Reloads the stemmer override dictionary from an input stream.- Parameters:
updater- An optional updater to apply changes.in- The input stream to read the dictionary from.- Throws:
DictionaryException- if the input stream cannot be parsed.
-
getSimpleName
Returns the simple name of the dictionary file.- Returns:
- The file name without the path.
-
update
Updates the dictionary file with content from an input stream.- Parameters:
in- The input stream containing the new dictionary content.- Throws:
IOException- if an I/O error occurs.
-
toString
-