feat: support text index on lower(Body) with no preprocessor#2326
Draft
pulpdrew wants to merge 4 commits into
Draft
feat: support text index on lower(Body) with no preprocessor#2326pulpdrew wants to merge 4 commits into
pulpdrew wants to merge 4 commits into
Conversation
When a text index is defined as `INDEX lower(Body) TYPE text(tokenizer=...)` (without a preprocessor), the generated hasAllTokens conditions now use `hasAllTokens(lower(Body), lower(...))` to match the index expression. When the index is directly on Body (or uses a preprocessor), the existing behavior of `hasAllTokens(Body, ...)` is preserved. Resolves HDX-4320 Co-authored-by: Drew Davis <pulpdrew@gmail.com>
🦋 Changeset detectedLatest commit: 3b46472 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
Contributor
E2E Test Results✅ All tests passed • 178 passed • 3 skipped • 1233s
Tests ran across 4 shards in parallel. |
Apply lower() in the SQL expression (hasAllTokens(lower(Body), lower('...')))
rather than lowercasing tokens in JavaScript, for consistency with the
hasToken(lower(...), lower(...)) pattern used elsewhere in the file.
Co-authored-by: Drew Davis <pulpdrew@gmail.com>
Co-authored-by: Drew Davis <pulpdrew@gmail.com>
Co-authored-by: Drew Davis <pulpdrew@gmail.com>
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.
Summary
When a text index is defined as
INDEX lower(Body) TYPE text(tokenizer='splitByNonAlpha')(no preprocessor), the Lucene-to-ClickHouse transpiler now generateshasAllTokens(lower(Body), lower(...))conditions instead ofhasAllTokens(Body, ...).Previously,
findTextIndexwould correctly detect the covering index onlower(Body)but then emithasAllTokens(Body, 'token')which doesn't utilize the index. Now, the transpiler detects whether the index expression wraps the column inlower()and adjusts both the column argument and the token values accordingly.Behavior:
lower(Body)(no preprocessor): generateshasAllTokens(lower(Body), 'lowercased_token')Body(with or without preprocessor): continues generatinghasAllTokens(Body, 'token')(unchanged)UseTextIndex.Enabledmode (no index detection): continues generatinghasAllTokens(Body, 'token')(unchanged)How to test on Vercel preview
N/A — non-UI change
References
Linear Issue: HDX-4320