Skip to content

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).

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.

If the index becomes stale (e.g., after manual database changes or a schema migration), rebuild it:

Terminal window
fialr search --reindex

This reads all enrichment data from the files and paths tables and repopulates the search index.


Standard search passes the query directly to SQLite FTS5:

Terminal window
fialr search "invoice acme"

FTS5 supports:

SyntaxMeaningExample
Space-separated wordsAND (all must match)invoice acme
Quoted phrasesExact phrase match"quarterly report"
OREither terminvoice OR receipt
* suffixPrefix matchquart*

Results are ranked by FTS5 relevance score.

Narrow results by category or sensitivity tier:

Terminal window
# Only financial files
fialr search "receipt" --category financial
# Only Tier 1 files
fialr search "passport" --sensitivity 1

AI search uses the configured enrichment provider to interpret natural-language queries:

Terminal window
fialr search "tax documents from last year" --ai

The 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 finds files based on meaning, not keywords. The query is encoded into a vector embedding and compared against file embeddings using cosine similarity.

Terminal window
fialr search --semantic "quarterly financial reports"

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”.

Semantic search requires embeddings. Generate them with:

Terminal window
fialr enrich ~/Documents --embed-only

The 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.


ModeFlagFindsRequires
Keyword(none)Exact term matches in metadataEnriched files
AI--aiConceptually related terms via LLM expansionEnriched files + Ollama
Semantic--semanticFiles similar in meaning via vector comparisonEmbeddings + 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.


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.