Search
Relevance-ranked text retrieval is a different shape from a row lookup, and standing a separate search cluster beside the data platform is how an estate ends up with a second copy of its documents under a second security model.
System9 carries a full-text search engine as one of the engine families on the same governed substrate, so a search index is cataloged, classified, workspace-scoped and policy-enforced like a table.
The index model
A search index holds documents under named fields, and each field has a type that decides how it is analyzed.
| Field type | How it is indexed |
|---|---|
| text | Run through the analysis pipeline, then stored in a positional inverted index |
| keyword | Stored verbatim (lowercased) for exact match, not tokenized |
| numeric | Carried on the document for filtering and aggregation, not full-text searched |
A text field is tokenized, stop-word filtered and stemmed, and the result is written to an inverted index that records, for each term, the documents that contain it and the positions within each document. Positions are what make phrase-aware highlighting and position-sensitive scoring possible rather than a bag-of-words approximation.
The analysis pipeline is language-aware. Tokenization normalizes Unicode and splits on word boundaries; a per-language stop-word list and a per-language stemmer then run. For languages without spaces between words the tokenizer emits character unigrams and bigrams instead.
Ranking is BM25, the standard relevance function, with the usual k1 and
b parameters (defaults 1.2 and 0.75) tunable per field. Each index also
tracks document frequency per term and per-field document lengths, which is
exactly the state BM25 needs.
What you can ask
| Capability | Notes |
|---|---|
| Ranked full-text query | BM25 across one or many fields, with a per-field boost |
| Boolean query | must, should, must_not, filter, with a minimum_should_match |
| Fuzzy matching | Query terms expanded to vocabulary terms within an edit distance |
| Synonyms | Bidirectional synonym groups expand a query term |
| Facets | Value counts over a field, computed across the full match set |
| Aggregations | Stats, term counts, histogram and custom range buckets |
| Highlighting | Matched terms wrapped in a configurable marker |
| Suggest | Prefix completions ranked by document frequency |
| Field and multi-index search | A single field, or several indexes merged by score |
| Scroll | A point-in-time cursor for paging a large result set |
| Aliases | A name that resolves to an index, swappable without changing callers |
How it scales
Each shard runs its own search engine instance, so indexes, documents and scoring statistics are isolated per shard. A query that spans a database's shards and the cells that own them goes through a scatter-gather coordinator, the full-text sibling of the SQL cross-cell read, over the same cluster fabric.
Two properties of that fan-out are worth stating:
- Term statistics are merged before scoring. A distributed search runs a two-phase protocol: phase one collects per-shard term statistics and merges them into a single document-frequency view, phase two re-scores each shard with those global statistics. Without it, a term that is rare across the corpus but common on one shard would be mis-ranked. A faster single-phase mode that scores each shard independently is available for shards that are statistically similar.
- A failed shard or cell is skipped, not fatal. The scatter applies a best-effort partial-failure policy: an unreachable slice is logged and left out of the merge rather than aborting the whole search, and the response reports how many cells were queried against how many answered.
Document placement across cells is by consistent hashing on the document id, so each document has exactly one owning cell (single-writer) and the merge deduplicates by document id, keeping the highest score.
Performance characteristics
A term lookup is a hash into the inverted index followed by a walk of that term's postings, so query cost tracks the number of matching postings and the number of query terms, not the size of the corpus. BM25 scoring is arithmetic over counts the index already holds.
The cost worth planning for is fuzzy matching: expanding a term to its near-neighbors compares it against the field's vocabulary with an edit-distance computation per candidate, so a fuzzy query over a large vocabulary does more work than an exact one. Exact, boolean and faceted queries do not pay that cost.
Hybrid semantic search
An index can blend lexical and semantic relevance. When a field is enabled for semantic search, documents indexed into it are embedded through the same governed, token-metered embedding bridge the vector engine uses, and the embedding is stored alongside the document. A semantic query embeds the query text the same way and mixes the embedding cosine with the BM25 score by a caller-set weight.
The candidate set is the union of lexical hits and embedded documents, so a document with a strong embedding match but no literal term overlap still surfaces. Enabling semantic search adds the embedding cost at index and query time; an index left lexical-only pays none of it.
It is governed like everything else
This is the reason it belongs in the data platform rather than beside it.
The internal write and read API is gated by platform read and write permissions. The external, credential-authenticated surface re-enters the same enforcement every other engine uses: a request authenticates with a per-database credential over TLS, which resolves to a directory entity; the request then runs the same data-security evaluation as any other engine, against the search index as a policy-bearing asset. Classification, clearance and attribute-based rules are evaluated, a rate limiter scoped to that caller applies, and every allow or deny is audited.
Two specifics matter here:
- Field masks are applied to hit sources and highlight snippets before they leave the cell, so a masked field cannot leak through a returned document or a highlighted fragment.
- The external search face is read-only. Index mutation stays on the internal write path, so a search credential cannot change what is indexed.
The authorizer the external face calls is the same one the engine's own interceptors use. There is no parallel authorizer for the search surface.
How it relates to the catalog and the other engines
A search index is a catalog asset. A catalog bridge tracks each index, syncs its statistics, and runs drift detection that reports an index present in the catalog but missing from the engine, or present in the engine but missing from the catalog. That asset identity is also what policy binds to when the external surface evaluates access.
Search sits next to two neighbors it is easy to confuse with:
- The document engine can attach a SQLite FTS5 index inside a collection for full-text matching within that collection's documents. That is local to the collection. This engine is the standalone, cross-shard, BM25-ranked search service with facets, fuzzy matching and distributed scoring.
- The vector engine answers "what does this mean"; this engine answers "where does this term appear", and the hybrid mode above is the two working together on one index.
Honest limits
- The index is in memory. The engine holds its inverted index and documents in memory; durability comes from a per-shard write-ahead log and periodic snapshot, replayed on restart. Size the resident set for the corpus you keep searchable, the same way the time-series hot tier is sized.
- Stemming is rule-based and language-limited. Stemmers exist for English, German, French and Spanish and are deliberately simple suffix rules, not a full linguistic stemmer. Chinese, Japanese and Korean are tokenized by character unigram and bigram with no stemming. A language outside this set is tokenized and stop-word filtered but not stemmed.
- Cross-cell BM25 is consistent within a cell, not yet across cells (PARTIAL). The two-phase protocol merges term statistics across the shards of one cell, so ranking is globally consistent there. Across cells, hits are merged by each cell's local score; a cross-cell global-statistics pre-pass is a named follow-on rather than something silently assumed.
Related
- Engines and access methods, where search sits among the engine families.
- FluxDB execution cores, the document and vector engines it works with.
- In-engine enforcement, the policy plane the external face re-enters.
- Scale-out and distribution, how engines shard and place across cells.