Skip to content

The library

The library (~/.dmshlabs/dictshelf/db, DB_DIR) holds DictShelf'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; faster, less memory
+ contains index the same text.db + contains
+ full-text index the same text.db + full-text

A dictionary is searchable as soon as DictShelf finds it. DictShelf queues its headword index when the dictionary is added or found by Rescan. The queue's concurrency is calculated from the machine's logical processors. Until the index is ready, exact and prefix searches use the dictionary's own format. Search does not start indexing.

ZIM is not added to the indexing queue: its own index answers exact and prefix search with little memory, and an indexed copy is several times the size of the file. The ZIM index cannot be changed in Dictionary Settings.

The contains index, the full-text index and the media pack are added per dictionary with its switches in the dictionary panel, or with dictshelf ingest.

Library folder

~/.dmshlabs/dictshelf/db/Oxford/
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 when that reduces its size, so an indexed dictionary is usually smaller than its dictionary files.

Move a dictionary to another machine

  1. Copy the library folder, e.g. ~/.dmshlabs/dictshelf/db/Oxford.
  2. Put it in the other machine's library, or in one of its dictionary folders.
  3. Search. The dictionary files are not needed; without media.db there are no images or audio.

Index from the terminal

dictshelf ingest                    # the dictionary folders (DICT_DIR)
dictshelf ingest ~/Dictionaries/es  # one folder

ingest skips dictionaries already indexed and gives a new dictionary the headword index only, as the app does. -contains and -fulltext add those indexes, -full also adds the media pack, -contains=false and -fulltext=false remove them. A flag left out keeps what each dictionary has. See ingest.

Outdated indexes

An index is outdated when an older version of DictShelf built it, or when the dictionary files changed since. The dictionary panel then shows N dictionaries have outdated indexes and Rebuild; dictshelf 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, the dictionary files stay in place. Use Dictionary Settings to create the index again before you need the library copy.

Deletion is permanent

Files are unlinked, not moved to the Trash or the Recycle Bin.

When running DictShelf 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

dictshelf clean               # list broken or incomplete library folders, and orphans
dictshelf clean -f            # delete the broken ones
dictshelf clean -f -orphans   # and the orphans
dictshelf rm Oxford           # list what removing Oxford would delete
dictshelf 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.

Command line reference