Repository navigation
feat: add the dict command for the dictionary admin API - #44
Merged
Merged
Conversation
Add fessctl dict list (the dictionary files) and, for each of synonym, mapping, kuromoji, stopwords, protwords and stemmeroverride, the subcommands list, get, create, update, delete, upload and download. The six types share one implementation; each keeps the entry fields of its admin API form. update reads the entry first and sends back the unchanged fields. upload asks for confirmation unless --yes; download writes to standard output or to --file (not overwritten without --force). The API exists in 14.19.2, 15.6.1, 15.7.0, 15.8.0 and 15.9.0. Uploads are POST multipart in 14.x and 15.9; Fess 15.6 to 15.8 only route a PUT that cannot read a multipart body, so upload is refused there. list_dict_items takes a dictionary type and ID, so the shared client paging test now supplies placeholders for required parameters.
# Conflicts: # skills/fessctl/SKILL.md
This was referenced Oct 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds the
dictcommand for the dictionary admin API (/api/admin/dict):fessctl dict list [--type TYPE]- the dictionary files (type, id, path, timestamp). Dictionary IDs come from here.fessctl dict <type> list|get|create|update|delete|upload|download <dict_id> ...forsynonym,mapping,kuromoji,stopwords,protwordsandstemmeroverride.The six types share one implementation (
src/fessctl/commands/dict.py); each keeps the entry fields of its admin API form (synonym--source/--target->inputs/outputs, mapping--source/--target->inputs/output, kuromoji--token --segmentation --reading --pos, stopwords and protwords--word->input, stemmeroverride--source/--target->input/output). Repeatable options are sent one value per line.updatereads the entry first and sends back every field it was not asked to change (the PUT replaces the whole entry; the entries carry no version fields).uploadreplaces a whole dictionary file, so it asks for confirmation unless--yes.downloadwrites to standard output, or to--file(refuses to overwrite without--force).--output text|json|yamleverywhere; non-zero exit on API failure.stemmeroverride(lower case). The route comments in the Java saystemmerOverride, but only the lower-case path routes.list_dict_itemstakes a type and a dictionary ID, soTestListPaging.test_every_list_method_puts_paging_in_bodynow passes placeholder values for required parameters oflist_*methods (the only change totests/unit/test_client.py).Versions
The API, paths and fields are the same in 14.19.2, 15.6.1, 15.7.0, 15.8.0 and 15.9.0 (14.x uses PUT for create and POST for edit, which
send_requestalready maps). Two differences:fessctlrefuses it on those versions with an explanatory error. (15.9.0 also keeps the PUT route, which fails the same way.)"0"instead of the new entry's ID, and creating in an unknown dictionary reports success without storing anything; on 15.9 it fails.Verified live
Against Fess 15.9.0 + fess-opensearch 3.9.0 (own compose stack):
dict list(103 files), and for all six types create / get / list (paged) / update (partial, fields kept) / delete, with unique values and nothing left behind; error paths (unknown entry, unknown dictionary, duplicate and invalid values, missing option); download to stdout and to a file (byte-identical to the stored file; overwrite refusal and--force); upload and restore of a file (download equals the uploaded bytes), declined confirmation, missing file, unknown dictionary.tests/commands/test_dict.py(10 tests: list, a CRUD flow per type, error paths, download/upload round trip that restores the file) passed 10/10 on 15.9.0, 15.8.0, 15.7.0, 15.6.1 and 14.19.2, through a stub conftest pointing at those servers. On 15.6.1 to 15.8.0 the upload test asserts the refusal instead.uv run pytest tests/unit: 221 passed.Not verified
tests/commands/test_dict.pywas not run through the repo's ownfess_servicecompose fixture; it is import-checked (--collect-only) only.Server oddities seen (not changed here)
outputreturns success with id"0"and stores nothing (the CLI requires--target).error_code:..., status 2); 15.9 validates it.listof an unknown dictionary ID returns an empty list with status 0.required=Trueon non-repeatable options (also true for existing commands such astagtype create --owner x, where the server reports the missing name);dict createchecks its options itself.Stacked PRs (merge from the bottom; each PR's base is the branch below it, so no conflicts remain):
main← #45 theme timeout (+ CI runs for stacked PRs) ← #46 typer ← #43 ops commands ← #44 dict ← #41 general/plugin/storage ← #42 searchlist/documents.After a PR is squash-merged GitHub retargets the next one to
main.