Package org.codelibs.fess.dict.stopwords
Class StopwordsFile
Manages a dictionary file for stopwords.
This class handles reading, parsing, and updating files that contain
a list of stopwords. Each line in the file represents a single stopword.
The class provides methods for retrieving, adding, updating, and
deleting stopword items, as well as reloading the dictionary
from its source file.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected classAn inner class for updating the stopwords 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
ConstructorsConstructorDescriptionStopwordsFile(String id, String path, Date timestamp) Constructs a new stopwords file. -
Method Summary
Modifier and TypeMethodDescriptionvoiddelete(StopwordsItem item) Deletes a dictionary item.org.dbflute.optional.OptionalEntity<StopwordsItem> 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(StopwordsItem item) Inserts a new dictionary item.protected voidreload(StopwordsFile.StopwordsUpdater updater) Reloads the stopwords dictionary from its source file.protected voidreload(StopwordsFile.StopwordsUpdater updater, InputStream in) Reloads the stopwords 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(StopwordsItem item) Updates an existing dictionary item.Methods inherited from class org.codelibs.fess.dict.DictionaryFile
getId, getTimestamp, manager, writeOut
-
Constructor Details
-
StopwordsFile
Constructs a new stopwords 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<StopwordsItem>- Returns:
- the dictionary type
-
getPath
Description copied from class:DictionaryFileGets the file path of this dictionary.- Overrides:
getPathin classDictionaryFile<StopwordsItem>- Returns:
- the file path
-
get
Description copied from class:DictionaryFileRetrieves a dictionary item by its ID.- Specified by:
getin classDictionaryFile<StopwordsItem>- 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<StopwordsItem>- 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<StopwordsItem>- Parameters:
item- the item to insert
-
update
Description copied from class:DictionaryFileUpdates an existing dictionary item.- Specified by:
updatein classDictionaryFile<StopwordsItem>- Parameters:
item- the item to update
-
delete
Description copied from class:DictionaryFileDeletes a dictionary item.- Specified by:
deletein classDictionaryFile<StopwordsItem>- Parameters:
item- the item to delete
-
reload
Reloads the stopwords 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 stopwords 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
-