Skip to content

Support case-insensitive string filters via static filtering - #405

Draft
MauruschatM wants to merge 1 commit into
get-convex:mainfrom
neunzig-zehn:feat/case-insensitive-filters
Draft

Support case-insensitive string filters via static filtering#405
MauruschatM wants to merge 1 commit into
get-convex:mainfrom
neunzig-zehn:feat/case-insensitive-filters

Conversation

@MauruschatM

Copy link
Copy Markdown

Motivation

The adapter currently rejects any where clause with mode: "insensitive". Several Better Auth surfaces send them — e.g. the dashboard's user/organization search sends contains / starts_with clauses with mode: "insensitive" — and those queries throw against the Convex adapter today. This PR supports them and enables the upstream caseInsensitiveTestSuite.

Changes

  • mode: "insensitive" is supported for eq/ne/in/not_in/contains/starts_with/ends_with: both sides are folded to lowercase and evaluated as static filters.
  • Insensitive clauses are excluded from index selection, from the unique-field fast path, and from the in fan-out to point lookups — Convex index lookups are case-sensitive.
  • Range operators (lt/lte/gt/gte) with insensitive mode still throw: case-insensitive ordering is ambiguous.

Performance note

An insensitive eq on a unique/indexed field (e.g. email) cannot use the index-backed lookup — it streams the table and filters statically, O(table size). For hot paths the existing recommendation stands: store values normalized (lowercased) on write and query case-sensitively. Happy to add a docs note if you can point me at where you'd want it — I didn't find an adapter-limitations section to update.

Tests

  • Enabled the upstream caseInsensitiveTestSuite.
  • Replaced the convex-custom test should reject case-insensitive where clauses with should reject case-insensitive range operators.

npm run build, npm run typecheck (src), and the full vitest suite pass: 10 files, 195 passed | 31 skipped (main baseline: 182 passed | 31 skipped).

@vercel

vercel Bot commented Jul 6, 2026

Copy link
Copy Markdown

@MauruschatM is attempting to deploy a commit to the Convex Team on Vercel.

A member of the Team first needs to authorize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant