Build a local SQLite search index for a ZIM file.
The index command creates a searchable SQLite database from ZIM archive contents. It extracts articles, builds an FTS5 full-text index, and creates semantic search embeddings with Model2Vec unless --no-semantic is passed.
- Full-text search: SQLite FTS5 on title, excerpt, and indexed article text
- Semantic search: Model2Vec embeddings stored as compact vectors in SQLite
- Vector search: Exact Go-side cosine ranking with bounded top-K memory
- Parallel indexing: Uses all CPU cores by default
zim index [--force] [--no-semantic] <zim-file>| Flag | Description |
|---|---|
--force |
Rebuild existing index without confirmation |
--no-semantic |
Build full-text index only and skip ONNX embedding initialization |
No database service is required. The default index is a SQLite file stored in the ZIM library directory.
Semantic indexing uses the bundled Model2Vec/ONNX embedding path. Use --no-semantic when you only need keyword search or want the fastest first index.
- Full-text only: fastest path; use
--no-semantic - With embeddings: depends on ONNX/Model2Vec throughput
- Parallel scaling: Near-linear with CPU cores
Index size depends on indexed text and whether semantic vectors are stored.
- Embedding generation: Model2Vec ONNX model memory
- Archive enumeration: streams the
Cnamespace beforeAinto a bounded worker queue instead of retaining directory-entry slices - SQLite indexing: local file writes, no database daemon
- Recommended: 4GB+ RAM for smooth indexing
zim index simple-wikizim index --no-semantic stackoverflowzim index --force simple-wikiIndexing progress shows:
Indexing: 123456 / 500000 articles (24%) | 345 articles/sec
Upon completion, the index is immediately usable with zim search.
SIGINT and SIGTERM cancel scanning, embedding, and pending writes. A rebuild removes the old generation before replacement begins, and a canceled or failed run removes its partial replacement before the command exits.
Import a rankings TSV only after indexing the archive:
zim popularity simple-wiki ./rankings.tsvBoth the archive and rankings file are required. The TSV uses one underscored article title per line; the line number becomes its rank.
The importer trims each line, changes spaces to underscores, and ignores empty keys. Duplicate keys keep their smallest line number. A key matches either an article URL or its title with spaces changed to underscores. If both keys match one article, the article receives the smallest rank. The reported match count is the number of distinct ranking keys that matched at least one article.
The import streams bounded 250-row batches into temporary SQLite tables, then replaces all popularity ranks for the selected archive in one transaction. Parse, cancellation, or SQL errors roll back the update, so existing ranks remain intact.
- Search Command - Search articles using the index
- Info Command - Check ZIM file and index status
- Library Command - Manage indexed ZIM files
- Architecture: Search System - Technical details on indexing