enquire-mcp API reference - v4.0.0-rc.7
    Preparing search index...

    Function hnswResultsToReceiptHits

    • Convert HNSW search results to receipt-bearing embedding hits using current rows hydrated from EmbedDb.getSearchRowsByIds(). Persisted HNSW sidecar previews are never an authority for this helper: stale, quarantined, or missing labels must already be absent from the supplied EmbedDb lookup. Cosine distance is converted back to similarity as 1 - distance.

      Parameters

      • result: { distances: number[]; labels: number[] }

        Labels and cosine distances returned by the native HNSW index.

      • rowByLabel: ReadonlyMap<number, Omit<EmbedReceiptSearchHit, "score">>

        Current receipt-bearing EmbedDb rows keyed by embedding id.

      Returns EmbedReceiptSearchHit[]

      Receipt-bearing hits for labels still present in the current EmbedDb.

      const rows = embedDb.getSearchRowsByIds(result.labels);
      const hits = hnswResultsToReceiptHits(result, rows);