Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Filter results

Constrain Telys searches and id listings to a partition or filter column using Eq or a single-key dict — the only filter Telys supports.

Telys filters by exact equality on a single column. Express it with Eq("column", "value") or an equivalent single-key dict {"column": "value"}. The same where argument works on search, search_text, and ids.

What you can filter on

A column is filterable only if it is either:

  • the collection's partition key (partition_by), or

  • listed in filter_columns at creation time.

Filtering any other column raises an error. Declare the columns you will query up front:

from telys import Telys
from telys.embedding import AlgentaMultigramEmbedder

telys = Telys("telys-store")
embedder = AlgentaMultigramEmbedder()

docs = telys.create_collection(
    "docs",
    dim=embedder.profile.dimension,
    partition_by="tenant_id",           # always filterable
    embedder=embedder,
    filter_columns=("lang", "topic"),   # also filterable
)
docs.add_texts(
    ["release notes for v2", "notas de la versión v2"],
    ids=["en-1", "es-1"],
    metadata=[
        {"tenant_id": "acme", "lang": "en", "topic": "release"},
        {"tenant_id": "acme", "lang": "es", "topic": "release"},
    ],
)
docs.save()

Pass where to search_text (or search). The Eq form and the dict form are equivalent:

Only records with lang == "en" match, so es-1 never appears.

Filter an id listing

ids(where=...) returns the live external ids, optionally scoped by the same filter — the fastest way to enumerate one partition without running a search:

Combine constraints without And/Or

With no boolean composition, encode a multi-attribute scope as a single string key with scope_key(...), store it in one column, partition or filter on that column, and match it with one Eq:

One Eq on the composed key now does the work of an AND across tenant and user.

Expected result

A filtered query returns only matching records; ids(where=...) returns the matching subset of ids:

Next steps

Last updated

Was this helpful?