class NativeBM25Index:
    def __init__(self, config_json: str | None = ...) -> None: ...
    @staticmethod
    def from_documents(
        documents: list[str],
        config_json: str | None = ...,
    ) -> "NativeBM25Index": ...
    @staticmethod
    def load(path: str) -> "NativeBM25Index": ...
    @staticmethod
    def load_mmap(path: str) -> "NativeBM25Index": ...
    @staticmethod
    def load_with_wal(
        path: str,
        wal_path: str,
        mode: str = ...,
    ) -> "NativeBM25Index": ...
    def save(self, path: str) -> None: ...
    def save_metadata(self, path: str) -> None: ...
    def insert_batch(self, documents: list[str]) -> None: ...
    def insert_documents(self, documents: list[tuple[str, str]]) -> None: ...
    def search(self, query: str, top_k: int) -> list[tuple[str, float]]: ...
    def search_weighted(
        self,
        terms: list[tuple[str, float]],
        top_k: int,
    ) -> list[tuple[str, float]]: ...
    def search_boolean(
        self,
        must: list[str],
        should: list[str],
        must_not: list[str],
        top_k: int,
    ) -> list[tuple[str, float]]: ...
    def search_phrase(
        self,
        terms: list[str],
        window: int,
        top_k: int,
    ) -> list[tuple[str, float]]: ...
    def delete_by_external_id(self, external_id: str) -> None: ...
    def compact(self) -> None: ...
    def compact_and_flush(self, index_path: str) -> None: ...
    def enable_wal(self, wal_path: str) -> None: ...
    def disable_wal(self) -> None: ...
    def replay_wal(self, wal_path: str) -> int: ...
    def stats_json(self) -> str: ...
    def vocabulary(self) -> list[tuple[str, int, int, int, int]]: ...
    def postings(self, term: str) -> list[tuple[int, int]]: ...
    def doc_length(self, doc_id: int) -> int | None: ...
    def sparse_vector_for_query(self, query: str) -> list[tuple[int, float]]: ...
    def sparse_vector_for_document(self, doc_id: int) -> list[tuple[int, float]]: ...
    def avgdl(self) -> float: ...
    def config_json(self) -> str: ...
    def stats_dict(self) -> dict[str, object]: ...


class NativeLatencyProfiler:
    def __init__(self) -> None: ...
    def record(self, total_ms: float) -> None: ...
    def p50(self) -> float: ...
    def p95(self) -> float: ...
    def p99(self) -> float: ...
    def p999(self) -> float: ...
    def len(self) -> int: ...


def native_rrf(
    primary: list[tuple[str, float]],
    secondary: list[tuple[str, float]],
    k: int = ...,
) -> list[tuple[str, float]]: ...
def native_linear_combination(
    primary: list[tuple[str, float]],
    secondary: list[tuple[str, float]],
    alpha: float = ...,
) -> list[tuple[str, float]]: ...
def native_min_max_normalize(values: list[float]) -> list[float]: ...
def native_z_score_normalize(values: list[float]) -> list[float]: ...
def native_cdf_normalize(values: list[float]) -> list[float]: ...
def native_ndcg_at_k(ranked: list[str], relevant: list[str], k: int) -> float: ...
def native_average_precision_at_k(ranked: list[str], relevant: list[str], k: int) -> float: ...
def native_recall_at_k(ranked: list[str], relevant: list[str], k: int) -> float: ...
def native_precision_at_k(ranked: list[str], relevant: list[str], k: int) -> float: ...
def native_mrr(ranked: list[str], relevant: list[str]) -> float: ...
