Opens an existing on-disk index, or creates a new one from a tnt_schema().
With path = NULL an in-memory index is created (useful for tests and
transient work).
Arguments
- path
Directory for an on-disk index, or
NULLfor an in-memory index. If the directory already contains an index it is opened (unlessoverwrite = TRUE).- schema
A
tnt_schema(). Required when creating a new index; ignored when opening an existing one.- overwrite
Logical. If
TRUE, an existing index atpathis deleted and recreated fromschema. Defaults toFALSE.- heap_mb
Indexing memory budget in MB (minimum 15). Defaults to 128.
Examples
sch <- tnt_schema(
id = tnt_i64(),
title = tnt_text(stemmer = "english"),
body = tnt_text(stemmer = "english")
)
idx <- tnt_index(schema = sch) # in-memory
idx
#>
#> ── <tnt_index> (in-memory)
#> 0 documents · 3 fields
#> • id: i64
#> • title: text [tnt_en]
#> • body: text [tnt_en]