SearchResult#

class scikitplot.corpus.SearchResult(doc, score, match_mode, backend=None, index_generation=None)[source]#

A single search result.

Parameters:
docCorpusDocument

The matched document.

scorefloat

Relevance score (higher is better). Scale depends on match mode:

  • STRICT: 1.0 if match, 0.0 otherwise

  • KEYWORD: Jaccard similarity [0, 1] or BM25 score

  • SEMANTIC: cosine similarity [-1, 1]

  • HYBRID: reciprocal rank fusion score

match_modestr

The mode that produced this result.

backendstr or None

Name of the dense ANN backend that produced this result (SEMANTIC/HYBRID), or None for STRICT/KEYWORD. Provenance only: excluded from equality and hashing.

index_generationint or None

The SimilarityIndex build generation that produced this result. Increments on every SimilarityIndex.build, so a caller can detect results computed against a since-rebuilt index. Provenance only: excluded from equality and hashing.

Parameters:
  • doc (Any)

  • score (float)

  • match_mode (str)

  • backend (str | None)

  • index_generation (int | None)

Notes

Developer note: backend and index_generation describe how the result was produced, not what it is, so they use compare=False — two results for the same document/score/mode remain equal regardless of provenance. Embedding-model identity is out of scope here (it travels with the document embeddings; see the embedding-cache identity contract).

backend: str | None = None#
doc: Any[source]#
index_generation: int | None = None#
match_mode: str[source]#
score: float[source]#