Skip to content

FullTextIndex

Defined in: libs/runtime/src/full-text.ts:85

Full-text search over a store’s things, in SQLite’s FTS5. It is kept current by the change log as things are written, and reached through db.changeLog.fullText.

Constructors

Name Description
new FullTextIndex() Opens the index over a database.

Methods

Name Description
count() How many things are indexed.
ensureSchema() Creates the index’s tables if they do not exist.
index() Index an entity’s current state, replacing whatever was there.
remove() Removes a thing from the index.
search() Search, using FTS5’s own query syntax.
assertAvailable() Throws with a usable message if this SQLite lacks FTS5, rather than failing obscurely later.

new FullTextIndex(db): FullTextIndex

Defined in: libs/runtime/src/full-text.ts:91

Opens the index over a database. It creates nothing until ensureSchema.

SqliteDatabase

The database that holds the index.

FullTextIndex

count(): number

Defined in: libs/runtime/src/full-text.ts:220

How many things are indexed.

number


ensureSchema(): void

Defined in: libs/runtime/src/full-text.ts:123

Creates the index’s tables if they do not exist.

void

if this SQLite has no FTS5.


index(entityId, state): void

Defined in: libs/runtime/src/full-text.ts:135

Index an entity’s current state, replacing whatever was there.

Called from projection, inside the same transaction as the data — an index updated afterwards can disagree with the store if the process dies between the two, and a search index that silently lags is worse than one that is obviously absent.

string

EntityState

void


remove(entityId): void

Defined in: libs/runtime/src/full-text.ts:159

Removes a thing from the index. Does nothing if it is not there.

string

void


search(query, limit?): readonly SearchHit[]

Defined in: libs/runtime/src/full-text.ts:208

Search, using FTS5’s own query syntax.

Column filters are written doctype:adr. Prefix is term*. Lucene’s fuzzy (~), boost (^) and range syntax have no equivalent: a query using them is a caller error here, not a silent empty answer.

string

number = 50

readonly SearchHit[]


static assertAvailable(db): void

Defined in: libs/runtime/src/full-text.ts:105

Throws with a usable message if this SQLite lacks FTS5, rather than failing obscurely later.

SqliteDatabase

void

TypeDBLite is an independent open-source project, built on TypeDB with thanks. It is not affiliated with, sponsored by, or endorsed by TypeDB Ltd. Released under the MPL-2.0 license.