enquire-mcp API reference - v3.9.0-rc.4
    Preparing search index...

    Interface HnswSearchContext

    v2.13.0 — optional HNSW context. When passed, embeddingsSearch routes the k-NN lookup through the in-memory HNSW index (sub-10ms at any scale) instead of the O(n) brute-force cosine in EmbedDb.search(). rowByLabel is the label → source-row mapping established at HNSW build time (typically labels are embeddings.id, set in EmbedDb.getAllVectors()).

    interface HnswSearchContext {
        ef?: number;
        index: {
            searchKnn(
                q: Float32Array,
                k: number,
                opts?: { ef?: number },
            ): { distances: number[]; labels: number[] };
        };
        modelAlias: string;
        rowByLabel: ReadonlyMap<
            number,
            {
                chunk_index: number;
                kind: "md"
                | "pdf";
                line_end: number;
                line_start: number;
                rel_path: string;
                text_preview: string;
            },
        >;
    }
    Index

    Properties

    ef?: number
    index: {
        searchKnn(
            q: Float32Array,
            k: number,
            opts?: { ef?: number },
        ): { distances: number[]; labels: number[] };
    }
    modelAlias: string

    v3.6.2 HN-4 — embedding-model alias the HNSW index was built with (e.g. "multilingual" or "bge"). At search time we verify that the embedder used to encode the query produces vectors in the SAME vector space as the index. CRIT-1 (v3.6.1) fixed the build-side silent destruction; this is the corresponding search-side guard.

    If the search-time embedder model doesn't match this alias, the stored vectors and the query vector are from different vector spaces — cosine returns garbage similarities. We throw instead of returning garbage; the agent / user can correct the --embedding-model flag and retry.

    rowByLabel: ReadonlyMap<
        number,
        {
            chunk_index: number;
            kind: "md"
            | "pdf";
            line_end: number;
            line_start: number;
            rel_path: string;
            text_preview: string;
        },
    >