Changelog - 2026-08-05
Search Filters Now Mean What Relational Filters Mean
Security Breaking Change Bug Fix EnhancementIn one line. The same where sent to Postgres and to a search engine now means the same thing - most importantly or: [], which used to widen a query instead of narrowing it.
What changed
- An empty
ormatches nothing, not everything.where: { or: permittedOrgIds.map(...) }on an empty permission list used to compile to an empty filter string, so a scoped query returned the whole collection to an unpermitted caller. deleteAllno longer truncates on that filter. Withforce: true, the same empty filter used to reachdeleteAll's "no effective where" branch and truncate. An absorbing where now deletes nothing.- Empty collections behave as in SQL.
inq: []and a bare[]match nothing;nin: []excludes nothing. Before, these emittedfield:=[], which engines reject. - A
whereon an undeclared field is a 400 naming the field, not a 500 from the engine. It usescore.search_engine.unknown_field. - Operators an engine cannot express are 400s naming the operator and the engine.
notBetweennow works on both engines.- Dialects publish
canExpress(operator), a complete operator table.
Who is affected
- Anyone building a
wherefrom a possibly-empty list (permission scopes, tag filters, id batches). This is the security fix. Re-read any code that maps a list intoororinq. Behaviour changes from "returns everything" to "returns nothing". - Anyone calling
ISearchQueryDialect.toWheredirectly. See Breaking changes. - Anyone filtering on a field absent from
defineSearchCollection. Declare the field, or stop filtering on it. - Everyone else. No action needed.
find,findOne,countandsearchkeep their signatures, and an ordinary filter compiles the same as before.
Breaking changes
WARNING
ISearchQueryDialect.toWhere now throws for a where that compiles to "match nothing". It is exported from @venizia/ignis and @venizia/ignis/typesense, so this is a public API change.
Before:
typescript
// Silently returns '' - the caller applies no filter and matches EVERYTHING
const filterBy = dialect.toWhere({ where: { or: [] } });After:
typescript
const compiled = dialect.compileWhere({ where: { or: [] } });
switch (compiled.outcome) {
case SearchFilterOutcomes.FILTER:
return search({ filterBy: compiled.filterBy });
case SearchFilterOutcomes.MATCH_NONE:
return { hits: [], found: 0 }; // never ask the engine
case SearchFilterOutcomes.MATCH_ALL:
return search({}); // no filter, deliberately
}toWhere still returns a plain string for every non-absorbing where, so a caller that never builds a filter from a possibly-empty list needs no change. It is marked @deprecated.
Details
- Only the caller's
whereis field-checked, not the model'sdefaultFilter.where. - A model with no
defineSearchCollectionis unvalidated: field checking is skipped, and it behaves as before. - Typesense has no null. An optional field is present or absent, and
filter_bycannot test which, soexists,notExistsandis: nullare reported as one limitation.
| Operator | relational | typesense | meilisearch |
|---|---|---|---|
eq ne gt gte lt lte in inq nin between notBetween | yes | yes | yes |
is isn | yes | value only | yes, incl. null |
exists notExists | yes | no | yes |
not | yes | no | no |
like ilike regexp and friends | yes | no | no |
contains containedBy overlaps | yes | no | no |
- The new rejections carry catalogued codes. The relational equivalents (
Invalid query operator,Column NOT FOUND) stay uncoded. - A caller who cannot read a hidden field can still probe its value through filter results. This is identical on the relational branch, which does not consult
hiddenPropertieswhen resolving awhereeither.