Skip to content

Conversation

vyavdoshenko
Copy link
Contributor

fix: Pattern matching error when query includes escaped special characters #4691

@vyavdoshenko vyavdoshenko changed the title fix: Tags for search query as prefix fixed. fix: prefix* matching for fields. Mar 31, 2025
@vyavdoshenko vyavdoshenko changed the title fix: prefix* matching for fields. fix: '@text:prefix*' matching for fields. Mar 31, 2025
dq \"
sq \'
esc_chars ['"\?\\abfnrtv]
esc_seq \\{esc_chars}
term_char [_]|\w
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why did you remove this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because \w has [ _ ] as part of its rule.
It duplicates it. It's useless, at least.

%}

blank [ \t\r]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This rule is useless.
There is no place where it is used.

@@ -191,6 +191,36 @@ TEST_F(SearchParserTest, Scanner) {
NEXT_EQ(TOK_DOUBLE, string, "33.3");
}

TEST_F(SearchParserTest, EscapedTagPrefixes) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need also add tests for that to the search_family_test
You can just copy snippet from the user's issue

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

@@ -77,6 +77,7 @@ tag_val_char {term_char}|\\[,.<>{}\[\]\\\"\':;!@#$%^&*()\-+=~\/ ]
{term_char}+"*" return Parser::make_PREFIX(str(), loc());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we have now two times + "*"
consider add a variable for *. And may be join this to methods (if possible)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

@vyavdoshenko vyavdoshenko merged commit ca0cdf8 into main Apr 4, 2025
10 checks passed
@vyavdoshenko vyavdoshenko deleted the bobik/tag_prefix_fix branch April 4, 2025 09:38
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.

2 participants