Search
Once files are enriched with metadata, fialr indexes them in a SQLite FTS5 full-text search table and can generate vector embeddings for semantic discovery. Three search modes are available: keyword (FTS5), AI-enhanced (LLM query expansion), and semantic (vector similarity).
Search index
Section titled “Search index”The FTS5 search index (search_index table) is populated automatically during enrichment. When fialr enrich processes a file, the enrichment output — entity, descriptor, tags, summary — is indexed alongside the file path, filename, category, and MIME type.
The index is a virtual table backed by the main SQLite database. It does not duplicate file content — only metadata.
Rebuilding the index
Section titled “Rebuilding the index”If the index becomes stale (e.g., after manual database changes or a schema migration), rebuild it:
fialr search --reindexThis reads all enrichment data from the files and paths tables and repopulates the search index.
Standard search
Section titled “Standard search”Standard search passes the query directly to SQLite FTS5:
fialr search "invoice acme"FTS5 supports:
| Syntax | Meaning | Example |
|---|---|---|
| Space-separated words | AND (all must match) | invoice acme |
| Quoted phrases | Exact phrase match | "quarterly report" |
OR | Either term | invoice OR receipt |
* suffix | Prefix match | quart* |
Results are ranked by FTS5 relevance score.
Filtering
Section titled “Filtering”Narrow results by category or sensitivity tier:
# Only financial filesfialr search "receipt" --category financial
# Only Tier 1 filesfialr search "passport" --sensitivity 1AI search
Section titled “AI search”AI search uses the configured enrichment provider to interpret natural-language queries:
fialr search "tax documents from last year" --aiThe provider extracts structured search terms, category filters, and date ranges from the query. These are used to build an FTS5 query internally. The provider processes only the query text — no file content is sent.
AI search respects the same provider configuration as enrichment. By default, queries go to Ollama locally. With cloud opt-in, queries go to the configured cloud provider.
Semantic search
Section titled “Semantic search”Semantic search finds files based on meaning, not keywords. The query is encoded into a vector embedding and compared against file embeddings using cosine similarity.
fialr search --semantic "quarterly financial reports"How it works
Section titled “How it works”The embedding model (default: nomic-embed-text via Ollama, 768-dimensional vectors) encodes both the query and the enriched file metadata into vectors. Cosine similarity measures how close the query vector is to each file vector. Files above the similarity threshold are returned, ranked by score.
This catches files that keyword search misses. Searching for “quarterly financial reports” finds files named 2024-q1-revenue-summary.pdf because embeddings capture the semantic relationship between “quarterly” and “q1”, and between “financial reports” and “revenue summary”.
Prerequisites
Section titled “Prerequisites”Semantic search requires embeddings. Generate them with:
fialr enrich ~/Documents --embed-onlyThe standalone fialr embed command is also available for backward compatibility. Embeddings are computed automatically during enrichment when the [embeddings] section is enabled in fialr.toml.
When to use each mode
Section titled “When to use each mode”| Mode | Flag | Finds | Requires |
|---|---|---|---|
| Keyword | (none) | Exact term matches in metadata | Enriched files |
| AI | --ai | Conceptually related terms via LLM expansion | Enriched files + Ollama |
| Semantic | --semantic | Files similar in meaning via vector comparison | Embeddings + Ollama |
Keyword search is fastest and most precise. AI search broadens recall by expanding terms. Semantic search finds conceptual matches that neither keyword nor AI search surface.
Privacy
Section titled “Privacy”Search is metadata-only. The FTS5 index contains filenames, entities, descriptors, tags, summaries, categories, and MIME types. No file content is stored in the search index. Embeddings are computed from metadata, not raw file content.
AI search sends only the query text to the provider. Semantic search runs entirely locally — the query is embedded via Ollama and compared against stored vectors. No data leaves the machine.
See also
Section titled “See also”- search CLI reference — full command documentation
- embed CLI reference — generate vector embeddings (also available via
fialr enrich --embed-only) - similar CLI reference — find similar files (also available via
fialr search --similar) - Enrichment guide — how metadata enters the search index
- enrich — populate metadata for search