Adds LIKE / NOT LIKE to the supported comparison operators for keyword - #11728
Open
Rasu-Dev wants to merge 1 commit into
Open
Adds LIKE / NOT LIKE to the supported comparison operators for keyword#11728Rasu-Dev wants to merge 1 commit into
Rasu-Dev wants to merge 1 commit into
Conversation
search attributes, enabling substring (Contains) filtering: - query: accept LikeStr/NotLikeStr; new like_pattern.go translates SQL LIKE patterns (%, _, escapes) for each backend - elasticsearch: map LIKE to a wildcard query (NOT LIKE via must_not) - sql: pass LIKE patterns through the SQL visibility converters - scheduler: treat NOT LIKE as a negative ScheduleId operator in the schedule ID query rewriter
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.
search attributes, enabling substring (Contains) filtering:
What changed?
Adds
LIKE/NOT LIKEto the supported comparison operators for Keyword search attributes in visibility queries, enabling substring ("Contains") filtering, e.g.:LikeStr/NotLikeStradded tosupportedComparisonOperators. NewConvertLikePatternToESWildcard(like_pattern.go) translates SQL LIKE patterns to Elasticsearch wildcard syntax (%→*,_→?, escaping literal*,?,\).LIKEmaps to awildcardquery on the keyword field;NOT LIKEwraps it inmust_not(both the current and legacy converters).LIKE/NOT LIKEpass through as native SQL LIKE comparisons. Restricted to Keyword attributes with a literal-string right-hand side; the user-supplied pattern is passed through unescaped since%/_are the intended wildcards (both converters).NOT LIKEis recognized as a negative operator in the ScheduleId query rewriter, matching the existing handling of!=/NOT IN/NOT STARTS_WITH.Why?
There is currently no way to filter visibility results by substring — Keyword attributes only support exact match and
STARTS_WITH. This enables "Contains" filtering, surfaced in the UI by a companion PR that adds a Contains option to the search-attribute filter dropdown emittingLIKE "%value%": .How did you test it?
New unit tests:
like_pattern_test.go(pattern translation incl._, escapes, literal*/?), ES converter tests (query_converter_test.go,converter_test.go), SQL converter tests (query_converter_test.go,query_converter_legacy_test.go), andschedule_id_query_rewriter_test.go. Existing converter tests updated for the expanded operator list.Manually: built the server, ran locally, and verified
LIKE/NOT LIKEqueries return correct substring matches via both directListWorkflowExecutionsqueries and the companion UI's Contains filter.Potential risks
LIKE "%value%"becomes a leading-wildcardwildcardquery, which cannot use the index prefix and scans terms — heavier than the existingSTARTS_WITHprefix query on large visibility indices.LIKEcase-insensitive, so the same query can match differently across visibility stores (an existing property of other string operators too).%/_is always treated as a wildcard; users cannot match those characters literally.