Skip to main content
Version: 0.0.7 (stable)

agrag.evidence.search.search_evidence

search_evidence(store:GraphStore, embedder:Embedder, query:str, *, mode:EvidenceSearchMode = EvidenceSearchMode.HYBRID, limit:int = DEFAULT_SEARCH_LIMIT, scope:frozenset[str], vector_store:VectorStore | None = None, reranker:Reranker | None = None, settings:RetrievalSettings | None = None, timeout:float | None = None) -> EvidenceSearchResult

Find up to limit visible passages that match a query.

The lexical leg matches the words of the query against chunk text. The semantic leg embeds the query and searches the chunk embeddings. The hybrid mode runs both and fuses them, or delegates fusion to an external store. Hybrid mode with a reranker reorders the top fused hits with the cross-encoder, and lexical and semantic modes never rerank. Search returns status index_not_ready when a needed index or external collection is missing. It returns empty_scope without searching when scope is empty.

Parameters:

  • store (GraphStore) – The graph store to search.
  • embedder (Embedder) – Embeds the query for the semantic leg. The lexical leg does not use it.
  • query (str) – The query text. Lucene syntax is not applied: each word is searched as a plain term.
  • mode (EvidenceSearchMode) – Which legs to run.
  • limit (int) – The most hits to return. Must be positive.
  • scope (frozenset[str]) – Keys of the documents that may be searched.
  • vector_store (VectorStore | None) – Optional external vector store. Placement is not validated by this function.
  • reranker (Reranker | None) – Scores passage texts against the query to reorder the top fused hits of hybrid mode. None runs hybrid search without rerank.
  • settings (RetrievalSettings | None) – Fusion and rerank configuration. None uses the defaults.
  • timeout (float | None) – Server-side transaction timeout in seconds for each store read. None uses the server's default.

Returns:

Raises:

  • ValueError – limit is not positive.