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

Search by text

Query a Telys collection with a plain string using search_text(), which embeds your query with the collection's embedder and returns the nearest records.

search_text is the text query path: pass a string, Telys embeds it with the collection's embedder and runs the same nearest-neighbor search as search. It is the counterpart to add_texts — if you added text, you search text.

Signature

Collection.search_text(
    text,
    top_k=10,
    where=None,
    explain=False,
    target_recall=None,
    with_metadata=False,
    mode="dense",
) -> dict
Parameter
Type
Default
Meaning

text

str

—

The query string. Embedded with the collection's embedder (via embed_queries).

top_k

int

10

Maximum number of results to return.

where

Eq | dict | None

None

Restrict to a partition/filter column (see Filter results).

explain

bool

False

Add an "explain" trace describing how the query ran.

target_recall

float | None

None

Per-query recall/latency hint for the planner (e.g. 0.95).

with_metadata

bool

False

Add a "metadata" list aligned with the returned ids.

mode

str

"dense"

"dense" embeds + vector-searches; "lexical" runs on-device BM25 over code tokens (no embedding). Lexical needs lexical=True at creation + build_lexical.

Like search, the result is {"ids": [...], "scores": [...]}, plus "explain" and "metadata" when requested. ids are ordered best-match first.

Basic query

Filter and tune per query

Expected result

You pass a string and get parallel ids and scores, best-match first, plus an aligned metadata list with with_metadata=True. No manual embedding step is involved:

With mode="lexical", search_text skips embedding and runs an on-device BM25 index over your code tokens — keyword/code recall with no model. It needs a collection created with lexical=True and a build_lexical() pass:

Same {"ids": [...], "scores": [...]} shape; rank by position (BM25 scores are not comparable to cosine). See Build a lexical index for the full workflow.

Next steps

Last updated

Was this helpful?