Appearance
Indexing & Analyzers
Configure how PiramideDB tokenizes text, stores vectors, and computes relevance when you create an index.
sql
CREATE INDEX documents_search_idx ON documents
USING piramidedb (tenant, body)
WITH (
format = 7,
analyzer = 'en',
scoring = 'visible'
);Index options
| Option | Default | Allowed values | When to use |
|---|---|---|---|
format | 7 | 7 | Recommended for all new indexes. Enables hybrid vector search, point-in-time filtering, facets, and grant-scoped scoring. |
analyzer | 'standard' | 'standard', 'en', 'pt', 'es', 'fr', 'de', 'it', 'nl' | Choose 'standard' for exact codes/identifiers or a language code for natural-language stemming. |
scoring | 'corpus' | 'visible', 'constant', 'corpus' | Use 'visible' whenever rows have per-user or per-role permissions. |
constant_avgdl | 50.0 | Any positive number | Average document length used only when scoring = 'constant'. |
Choosing an analyzer
standardfolds case and accents without stemming. Use it for SKUs, ticket IDs, logs, or mixed-language technical records where exact tokens matter.- Language analyzers (
en,pt,es,fr,de,it,nl) apply language-specific stemming so queries like rotating match rotated and rotation. Use them for articles, policies, support tickets, and knowledge bases.
Updating constant_avgdl online
If you use scoring = 'constant', you can tune constant_avgdl without rebuilding the index or blocking reads:
sql
ALTER INDEX documents_search_idx SET (constant_avgdl = 120.0);