Skip to main content
Version: 0.0.9

agrag.candidates.search.search_candidates

search_candidates(graph_store:GraphStore, query:str, *, kind:CandidateKind | None = None, limit:int = 10, scope_ids:frozenset[str] | None = None) -> list[CandidateRecord]

Find candidates that match any word in the query.

Search matches label, text, source_text, and target_text lexically. It excludes rejected candidates and ignores words shorter than three characters.

Parameters:

  • graph_store (GraphStore) – The store that holds the candidates.
  • query (str) – The words to look for.
  • kind (CandidateKind | None) – Only this kind. None searches every kind.
  • limit (int) – The most candidates to return.
  • scope_ids (frozenset[str] | None) – Document node ids whose evidence may be read. None allows every document.

Returns:

  • list[CandidateRecord] – Candidates ranked by matching-word count, then frequency.