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

    Function semanticSearch

    • Pure-JS lexical-semantic search via TF-IDF cosine similarity.

      Builds (or reuses cached) per-vault TF-IDF index, then ranks notes by cosine similarity of the query vector against each body vector. Catches "related-term" recall that the substring path of searchText misses (e.g. searching "retrieval" will surface notes about "recall" if the vocabulary co-occurs). Zero native deps — works on every platform with no model download. For full ML retrieval use embeddingsSearch; for graceful-degradation fusion use searchHybrid.

      Parameters

      • vault: Vault

        The vault to search.

      • args: { folder?: string; limit?: number; min_score?: number; query: string }

        query is required. limit defaults to 10. min_score defaults to 0.05 — anything below is pruned. folder restricts to a subdirectory.

      Returns Promise<
          {
              matches: SemanticHit[];
              method: "tfidf-cosine";
              query: string;
              total_docs: number;
          },
      >

      An envelope with query, total_docs (corpus size), method (always "tfidf-cosine"), and matches sorted by score desc.

      If query is empty / whitespace-only.

      const result = await semanticSearch(vault, {
      query: "vector retrieval cosine",
      limit: 5
      });
      for (const hit of result.matches) {
      console.log(hit.path, hit.score, hit.matched_terms);
      }