search command group handles all search index operations, including creating, deleting, and populating indexes with post data. Supports multiple search backends (Meilisearch, LNX, Typesense).
Usage
Subcommands
index
Manage the lifecycle of search indexes. These operations affect the index structure itself, not the data within it.index create
Create a new search index with the schema defined for your search provider.- Initial setup of search functionality
- After changing search providers
- Recovering from index corruption
- Calls
sp.init_indexes()followed bysp.finalize()(src/ayase_quart/cli/search_cli.py:17-18) - Creates index schema without loading data
- Safe to run on existing indexes (may fail if index already exists)
index delete
Remove all search index data. This is a destructive operation.- Switching search providers
- Clearing corrupt index data
- Reclaiming disk space before rebuilding
- Calls
sp.posts_wipe()(src/ayase_quart/cli/search_cli.py:14) - Removes all documents from the index
- Does not delete index schema/structure
index reset
Delete and immediately recreate the search index. Combinesdelete and create operations.
- After schema changes in the code
- Complete index refresh
- Troubleshooting index issues
- Calls
sp.posts_wipe(),sp.init_indexes(),sp.finalize()in sequence (src/ayase_quart/cli/search_cli.py:21-23) - Atomic operation (all steps complete together)
load
Populate the search index with post data from the database. Choose between full indexing or incremental updates.load full
Index all posts from specified boards. This is a one-time bulk operation.One or more board shortnames to index (e.g.,
a, vg, pol)- Initial index population
- After running
search index reset - Adding new boards to search
- Calls
load_full(boards)(src/ayase_quart/cli/search_cli.py:31) - Processes all posts in database for specified boards
- May take hours for large archives
- Progress is printed to console
load incr
Index posts that aren’t in the search index yet. Runs continuously when using the--cron flag.
One or more board shortnames to incrementally index
Run every N seconds. Omit this flag to run once and exit.
Press Ctrl+C to gracefully stop the cron loop. The command will complete the current indexing cycle before exiting.
- Keeping search index up-to-date with new posts
- Running as a background service
- Development/testing with frequent updates
- Calls
incremental_index_single_thread()in a loop (src/ayase_quart/cli/search_cli.py:38-40) - When
--cronis set, sleeps for specified seconds between runs - Gracefully handles KeyboardInterrupt (src/ayase_quart/cli/init.py:14)
- Closes database and search connections on exit (src/ayase_quart/cli/search_cli.py:48-49)
Typical workflows
Initial setup
Switching search providers
Troubleshooting index issues
If search isn’t working correctly:Performance considerations
Full load duration
Full load duration
Loading time depends on:
- Total number of posts in the database
- Search provider speed
- Database performance
- Network latency (if search provider is remote)
Incremental load frequency
Incremental load frequency
For
--cron interval, consider:- Post volume on your boards
- Search provider indexing speed
- System resource availability
Memory usage
Memory usage
The
load full command loads posts in batches to avoid memory issues. The search provider maintains its own memory/disk requirements.Error handling
| Error | Cause | Solution |
|---|---|---|
| Index already exists | Running create on existing index | Use reset instead |
| Search provider unreachable | Connection issues | Check provider status and config |
| Board not found | Invalid board shortname | Verify board exists in database |
| KeyboardInterrupt | User pressed Ctrl+C | Normal shutdown, safe to restart |
Supported search providers
The search commands work with any configured provider:Meilisearch
Fast, typo-tolerant search
LNX
Lightweight, fast indexing
Typesense
Typo-tolerant, scalable search
config.toml under the [search] section.
Running as a service
For production deployments, run incremental indexing as a system service:systemd example
/etc/systemd/system/ayase-search.service