Support case-insensitive string filters via static filtering - #405
Draft
MauruschatM wants to merge 1 commit into
Draft
Support case-insensitive string filters via static filtering#405MauruschatM wants to merge 1 commit into
MauruschatM wants to merge 1 commit into
Conversation
|
@MauruschatM is attempting to deploy a commit to the Convex Team on Vercel. A member of the Team first needs to authorize it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 sendscontains/starts_withclauses withmode: "insensitive"— and those queries throw against the Convex adapter today. This PR supports them and enables the upstreamcaseInsensitiveTestSuite.Changes
mode: "insensitive"is supported foreq/ne/in/not_in/contains/starts_with/ends_with: both sides are folded to lowercase and evaluated as static filters.infan-out to point lookups — Convex index lookups are case-sensitive.lt/lte/gt/gte) with insensitive mode still throw: case-insensitive ordering is ambiguous.Performance note
An insensitive
eqon 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
caseInsensitiveTestSuite.convex-customtestshould reject case-insensitive where clauseswithshould 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).