Skip to content

matchFilter

function matchFilter(metadata, filter): boolean;

In-memory evaluator for the canonical VectorFilter shape.

Runs a MongoDB-style filter against a plain metadata record and returns whether the record matches. Used by in-process vector stores (InMemoryVectorStore) and any downstream adapter that must re-filter results after a backend-level query — e.g. when the backend supports only a subset of operators and the remainder must be applied in memory.

Operator coverage matches the translators in ./sql.ts, ./lancedb.ts, and peers: $eq, $ne, $gt, $gte, $lt, $lte, $in, $nin, $exists, plus the logical combinators $and, $or, $not.

Parameter Type

metadata

Record<string, unknown>

filter

VectorFilter

boolean