Journal Management
Index Management
The journal index holds the searchable marks, reviews, notes, collections, articles and posts of each user.
-
neodb-manage journal idx-info: Show information about the search index -
neodb-manage journal idx-init: Check and create the index if it doesn't exist -
neodb-manage journal idx-destroy: Delete the entire search index -
Requires confirmation or
--yesflag -
neodb-manage journal idx-delete: Delete documents in the index -
Use
--ownerto delete only the documents of some identities -
neodb-manage journal idx-rebuild: Rebuild the search index -
Use
--ownerto rebuild only the documents of some identities,--batch-sizeto set how many documents are written at once -
neodb-manage journal idx-catchup: Update the index for pieces edited in the last X hours - Requires
--hour - Also drops the doc of a piece that no longer has its own, for example a comment that is now part of its mark
-
Example:
neodb-manage journal idx-catchup --hour 24 -
neodb-manage journal idx-sync: Compare the index with the database for each identity, add missing docs and delete stale docs, and purge the docs of deactivated identities - Use
--dry-runto preview,--ownerto sync only some identities,--remoteto sync remote pieces and identities instead of local ones - Example:
neodb-manage journal idx-sync --dry-run
Automatic index catch-up
The JournalIndexCatchup cron job runs every hour at 40 minutes past the hour, half an hour after the catalog job, and does what idx-catchup does for the pieces edited since its last good run. It works like the catalog index catch-up: it starts where the last run stopped, records its progress only after a batch whose writes Typesense took, skips a piece whose doc cannot be built, writes at most 10,000 pieces of each kind per run, and looks back at most 7 days. When a comment is part of a mark, it also refreshes the mark. It skips the pieces of deactivated identities, whose docs idx-sync purges. To disable it, add JournalIndexCatchup to NEODB_DISABLE_CRON_JOBS.
The catch-up finds changes by their edit time, so it does not repair:
- a piece that was deleted while the index was not available, because the piece is gone from the database;
- a post that has no piece, such as a plain reply;
- a piece that was never indexed and was not edited since;
- a piece from another server or from an import, if it arrived while the index was not available: such a piece keeps the edit time of its source, which can be older than the time the job looks back to.
idx-sync repairs these. It is not run by a cron job: it reads every document of every identity from the index and every indexable piece from the database, so its cost grows with the whole site, not with recent changes. Run it by hand after an index outage that lasted longer than the catch-up window, after a restore, or when search results look incomplete for a user.