The library¶
The library (~/.wudict/db, DB_DIR)
holds wudict's indexed copy of each dictionary: one library folder per
dictionary.
Indexing¶
| State | Searched via | Modes |
|---|---|---|
| not indexed | the dictionary files | exact, prefix |
| indexed | text.db (headword index) |
exact, prefix, wildcard; faster, less memory |
| + full-text index | the same text.db |
+ full-text |
A dictionary is searchable as soon as wudict finds it. On its first search
wudict indexes its headwords in the background
(AUTO_INDEX), one dictionary at a
time (INDEX_WORKERS). With
AUTO_INDEX = off, dictionaries stay not indexed and use more memory and CPU.
Lingvo DSL, Babylon and wudict markdown are indexed when first opened: they have no index of their own. ZIM is never indexed automatically: its own index answers exact and prefix search with little memory, and an indexed copy is several times the size of the file. Index a ZIM from the dictionary panel to use wildcard, full-text or a media pack.
The full-text index and the media pack are added per dictionary with its
switches in the dictionary panel, or with
wudict ingest.
Library folder¶
text.db articles and indexes
media.db media pack, if added
info.txt source and build details
res/ resource overrides (optional)
text.db alone is a complete dictionary. Without media.db, images and audio
are read from the dictionary files, if present. Both are SQLite databases;
The text.db format documents the schema.
Article text is DEFLATE-compressed, so an indexed dictionary is usually smaller
than its dictionary files.
COMPRESSION set to small makes
the library 1 % to 2 % smaller, and indexing takes up to 1.5 times as long.
NO_COMPRESS stores article text
uncompressed, about 3 times larger.
Move a dictionary to another machine¶
- Copy the library folder, e.g.
~/.wudict/db/Oxford. - Put it in the other machine's library, or in one of its dictionary folders.
- Search. The dictionary files are not needed; without
media.dbthere are no images or audio.
Index from the terminal¶
ingest skips dictionaries already indexed and gives a new dictionary the
headword index only, as the app does. -fulltext adds the full-text index,
-full also adds the media pack, and -fulltext=false removes the full-text
index. A flag left out keeps what each dictionary has.
See ingest.
Outdated indexes¶
An index is outdated when an older version of wudict built it, or when the
dictionary files changed since. The dictionary panel then shows N dictionaries have outdated indexes and Rebuild;
wudict reindex does the same from a terminal.
A rebuild keeps each dictionary's indexes and media pack. Stop ends
it after the current dictionary.
Remove a dictionary¶
☰ → the dictionary's file row (e.g. oald10.mdx) →
🗑 Remove…. The confirmation offers:
| Choice | Deletes |
|---|---|
| 💥 delete everything | the library folder and the dictionary files |
| index only | the library folder; the dictionary files stay |
| dictionary files only | the dictionary files; offered when the library folder is complete (media pack added, or no media) |
After index only, a dictionary still in a dictionary folder is indexed again
on its next search (AUTO_INDEX).
Deletion is permanent
Files are unlinked, not moved to the Trash or the Recycle Bin.
When running wudict on a LAN, from another host, removal needs
ALLOW_REMOTE_DELETE.
Remove an index¶
Click the corresponding switch in the dictionary panel. When the dictionary files are gone, the switches are locked: the library folder is the only copy.
Orphans¶
An orphan is a library folder whose original dictionary files are gone.
Rescan folders lists orphans with their sizes: ticked ones are
deleted, unticked ones are kept and not listed again. A dictionary file moved
within the dictionary folders is not an orphan; its library folder follows it.
A library folder kept with dictionary files only is never listed.
USE_CACHED lists orphans as
ordinary dictionaries.
From the terminal¶
wudict clean # list broken or incomplete library folders, and orphans
wudict clean -f # delete the broken ones
wudict clean -f -orphans # and the orphans
wudict rm Oxford # list what removing Oxford would delete
wudict rm -f Oxford # delete the library folder and the dictionary files
rm -keep-source deletes only the library folder, rm -keep-index only the
dictionary files. Neither command deletes anything without -f.