Open
Conversation
fix: add case-insensitive search support for keyword search Add a case-insensitive toggle to the keyword search sidebar that works across all three query engines (Gremlin, OpenCypher, SPARQL). Gremlin: Uses regex with (?i) flag. Escapes the `$` anchor as `\$` to prevent Groovy string interpolation errors. Regex metacharacters in search terms are escaped to avoid injection. OpenCypher: Wraps attribute values and search terms in toLower() for case-insensitive comparison. SPARQL: Uses regex() with "i" flag for partial matches and lcase() for exact matches. The toggle does not apply to ID-based searches since IDs are system-generated and case-sensitivity is not meaningful.
Collaborator
|
@mcgong720 Excellent. I just took a quick glance and I like it. I have a few other things to attend to before reviewing this. So it might be a few days before I can take a closer look. |
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.
Description
Add a case-insensitive search toggle to the keyword search sidebar that works across all three query engines (Gremlin, OpenCypher, SPARQL).
regex()with(?i)flag for case-insensitive matching. Escapes the$regex anchor as\$to prevent Groovy string interpolation errors. Regex metacharacters in search terms are escaped to avoid injection.toLower()for case-insensitive comparison on both partial and exact matches.regex()with"i"flag for partial matches andlcase()for exact matches.The toggle does not apply to ID-based searches since IDs are system-generated and case-sensitivity is not meaningful.
Validation
keywordSearchTemplate.test.ts- 6 new):regex("(?i).*term.*")syntaxregex("(?i)^term\$")with escaped$to prevent Groovy interpolationcontaining()or exact match)containing()and exact string matchtest.com) are escaped astest\\.comin partial matchtest\\.com\$)keywordSearchTemplate.test.ts- 5 new):toLower():toLower(toString(v.attr)) CONTAINS toLower("term")toLower(toString(v.attr)) = toLower("term")toString(id(v))withouttoLower)v.attr CONTAINS "term"withouttoLower()ALL_ATTRIBUTEStoken, limit, and offsetkeywordSearchTemplate.test.ts- 3 new):regex(str(?value), "term", "i")with the"i"flaglcase(str(?value)) = lcase("term")for string comparisoncaseInsensitiveflag is false (SPARQL'scontains()is inherently case-sensitive, so partial match always usesregexwith"i")useKeywordSearch.test.ts- 3 new):caseInsensitivedefaults tofalsefor Gremlin connectionscaseInsensitivedefaults tofalsefor OpenCypher connectionscaseInsensitivedefaults tofalsefor SPARQL connectionsregex("i")flag works for partial matches andlcase()works for exact matches.Related Issues
Check List
pnpm checksto ensure code compiles and meets standards.pnpm testto check if all tests are passing.Changelog.md.