pypaginate.search.engine

In-memory ranked search — a thin adapter over the native _core engine.

SearchEngine delegates filtering + relevance ranking (exact/prefix/contains matching, fuzzy / token-sort scoring, optional per-field weights, min/max limits) to pypaginate._core via pypaginate._native. The host only selects rows by the indices the engine returns.

Classes

SearchEngine

Stateless engine that searches sequences by SearchSpec (native).

Module Contents

class pypaginate.search.engine.SearchEngine

Stateless engine that searches sequences by SearchSpec (native).

apply(items: collections.abc.Sequence[T], spec: pypaginate.domain.specs.SearchSpec) list[T]

Filter and rank items by search relevance via the native engine.

Returns items in ranked (relevance) order. A query shorter than spec.min_length (or one that tokenizes to nothing) returns every item in original order, matching the engine’s contract.