TinyStore
Reference / Search API for Python
On this page

Reference / Search API for Python

Search API for Python

Every public class, function and type of the Search engine in tinystore, generated from its source. The Search guide explains how to use them, and the Bun and Node, Go and Rust pages list the same API.

Vectors

python
@dataclass(frozen=True, slots=True)
class Vectors:
    dimensions: int
    recall: float | None = None
    column: str | None = None

A vector the program's model gives each document, and recall for searches from clusters.

A table's index names the column of blobs that holds them.

Hybrid

python
@dataclass(frozen=True, slots=True)
class Hybrid:
    vector_weight: float | None = None
    rerank: bool | None = None

How a search by words and a vector at once combines them: a vector weight, or the words' best reranked.

Hit

python
@dataclass(frozen=True, slots=True)
class Hit[T]:
    id: str
    value: T
    score: float

A document a search found, and the score that ordered it among this search's hits.

Result

python
@dataclass(frozen=True, slots=True)
class Result[T]:
    hits: list[Hit[T]]
    corrected: str | None = None

What a search found, the best first, and the text it read in fact when a word was misspelt.

IndexStatus

python
@dataclass(frozen=True, slots=True)
class IndexStatus:
    state: Literal['ready', 'rebuilding', 'failed']
    done: float = 0.0
    error: str = ''

Where an index stands: ready, rebuilding with how much is done, or a rebuild that failed and why.

IndexInfo

python
@dataclass(frozen=True, slots=True)
class IndexInfo:
    name: str
    documents: int
    vectors: int
    opened: datetime | None  # when a program last opened it
    status: IndexStatus

An index as store.indexes() lists it.

SearchIndex

python
class SearchIndex[T](_Searchable[T]):
    ...

Documents of one type by id, found again by their words, vectors or both: store.index(name, Article).

SearchIndex.set

python
async def set(id: Key, value: T, *, vector: Vector | None = _UNSET) -> None: ...

Sets the document id to value, replacing it whole; the next search sees it.

On an index with vectors a set gives its vector, or None for a document only its words find.

SearchIndex.set_many

python
async def set_many(
    documents: Sequence[tuple[Key, T] | tuple[Key, T, Vector | None]],
) -> None: ...

Sets every document in one commit, all of them or none: (id, value) or (id, value, vector), 1,000 at most.

SearchIndex.delete

python
async def delete(id: Key) -> bool: ...

Deletes the document id; says whether there was one.

SearchIndex.get

python
async def get(id: Key) -> T | None: ...

The document id, or None.

TableIndex

python
class TableIndex[T](_Searchable[T]):
    ...

A table's rows found again by their words, vectors or both, each hit's value its row as db.all reads it.

The table owns the rows, and every change of one reaches the index in the commit that makes it.

Generated from the source Updated 19 October 2026

esc
↑↓ navigate ↵ open ⇥ filter 0 results