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

No results / recall

Fix empty search results (unsaved data, wrong partition or where filter, no embedder) and poor recall (wrong embedder, missing IVF, or a low target_recall).

Two problems hide behind "search isn't working": zero results (nothing comes back) and poor recall (results come back, but miss the ones you expected). Zero results is almost always a scope, filter, or embedder wiring problem; poor recall is about embedder choice and the index. Work them in that order.

Check the collection first with len(col) and col.stats(). A zero count is an ingest or persistence problem, not a search problem — see the "empty results" entries below.

Empty results

Search returns nothing right after adding — data was never saved

create_collection(...) builds and caches the collection in memory but does not write to disk. open_collection(...) and collections() only see collections persisted with save().

Cause: you added rows, then reopened the store in a new process without calling save(), so the reopened collection is empty (or doesn't exist).

Fix: save after ingest; the write to collection.json is the commit point.

from telys import Telys
from telys.embedding import AlgentaMultigramEmbedder

emb = AlgentaMultigramEmbedder()
mem = Telys("./memory")
col = mem.create_collection("notes", dim=emb.profile.dimension,
                            partition_by="scope", embedder=emb)
col.add_texts(["first note", "second note"], ids=["n1", "n2"],
              metadata=[{"scope": "demo"}, {"scope": "demo"}])
col.save()                       # commit — id_map.npy then collection.json

# New process:
mem = Telys("./memory")
col = mem.open_collection("notes")
print(len(col))                  # 2, because it was saved

Within one process, the cached collection sees your data immediately; save() only matters across processes and restarts.

Search returns nothing — a where filter or partition excludes every row

Telys filters and partitions are strict equality. Eq(column, value) (or a single-key dict) is the only filter — no AND/OR/NOT or range operators. Rows live in the partition set by partition_by; a query sees only the partition and filter you scope it to.

Cause: the where value doesn't exactly match stored metadata, or you're searching a different partition than you wrote to.

Fix: drop the filter to confirm data exists, then re-apply the exact-match filter. List which ids are present with ids().

from telys import Eq

col.search_text("quarterly plan", top_k=5)                       # no filter — does anything come back?
col.search_text("quarterly plan", top_k=5, where=Eq("tenant_id", "acme"))
col.ids(where=Eq("tenant_id", "acme"))                           # exactly which ids match this filter

A list/tuple partition_by uses only its first element as the physical key — it is not composite. To scope by several fields, compose one key with scope_key(...).

from telys import scope_key

key = scope_key("acme", "user-42")     # single composite partition key
RuntimeError on search_text / add_texts — no embedder attached

The *_text methods embed text before searching or adding, so they require an embedder. Raw-vector methods (search, add) don't.

Cause: the collection has no embedder — you created it without one, or opened it and no matching provider was registered to auto-attach.

Fix: attach an embedder at create/open time, or register a provider so open_collection can auto-attach it by model_id / space_id.

from telys import Telys
from telys.embedding import AlgentaMultigramEmbedder

emb = AlgentaMultigramEmbedder()
mem = Telys("./memory")
col = mem.create_collection("notes", dim=emb.profile.dimension,
                            partition_by="scope", embedder=emb)
col.add_texts(["hello world"], ids=["a"],
              metadata=[{"scope": "demo"}])       # works — embedder present

With raw vectors only, use add(...) / search(...) and skip the embedder.

Poor recall

Results come back, but the right ones are missing — wrong embedder for the task

The two built-in embedders are lexical, not dense. AlgentaBigramEmbedder and AlgentaMultigramEmbedder match on shared character n-grams — excellent for code, identifiers, and near-exact text, weaker for paraphrase or cross-lingual matches. For semantic paraphrase, use a dense model via CallableEmbedder.

Cause: the embedder's notion of similarity doesn't match your query intent.

Fix: pick the embedder that fits the workload. Collection and query must use the same space; you can't mix.

from telys.embedding import AlgentaMultigramEmbedder, CallableEmbedder

lexical = AlgentaMultigramEmbedder()      # strong for code / identifiers / near-exact text
# dense = CallableEmbedder(fn, profile)   # bring your own model for semantic paraphrase

Next: Choosing an embedder

Recall drops as the collection grows — build the IVF index and tune

Small collections are searched exactly. As they grow, approximate (IVF) search trades a little recall for speed; if the index isn't built or nprobe is too low, recall suffers.

Cause: the collection is large enough for approximate search but the IVF index isn't built, or the recall target is too low.

Fix: raise target_recall per query, build the index explicitly, or run a tuning pass and apply it.

target_recall is a local-collection feature; RemoteCollection.search does not accept it.

Next steps

If search raises a dimension or length error instead of returning too little, the query width doesn't match the collection.

Next: Embedding dimension mismatches

Last updated

Was this helpful?