Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(search): add TAGGED as an alternative syntax to HASTAG #2692

Merged
merged 2 commits into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/search/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,4 @@ Note that when interacting with users, we also refer to KQIR as *Kvrocks Search*

- [KQIR: a query engine for Apache Kvrocks that supports both SQL and RediSearch queries](https://kvrocks.apache.org/blog/kqir-query-engine)
- [Index encoding format for Kvrocks Search](https://kvrocks.apache.org/community/kvrocks-search-index-encoding)
- [User documentation of Kvrocks Search](https://kvrocks.apache.org/docs/kvrocks-search)
3 changes: 2 additions & 1 deletion src/search/sql_parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ struct StringOrParam : sor<StringL, Param> {};
struct NumberOrParam : sor<Number, Param> {};

struct HasTag : string<'h', 'a', 's', 't', 'a', 'g'> {};
struct HasTagExpr : WSPad<seq<Identifier, WSPad<HasTag>, StringOrParam>> {};
struct Tagged : string<'t', 'a', 'g', 'g', 'e', 'd'> {};
struct HasTagExpr : WSPad<seq<Identifier, WSPad<sor<HasTag, Tagged>>, StringOrParam>> {};

struct NumericAtomExpr : WSPad<sor<NumberOrParam, Identifier>> {};
struct NumericCompareOp : sor<string<'!', '='>, string<'<', '='>, string<'>', '='>, one<'=', '<', '>'>> {};
Expand Down
1 change: 1 addition & 0 deletions tests/cppunit/sql_parser_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ TEST(SQLParserTest, Simple) {
AssertIR(Parse("select a from b where y > 2"), "select a from b where y > 2");
AssertIR(Parse("select a from b where 3 >= z"), "select a from b where z <= 3");
AssertIR(Parse("select a from b where x hastag \"hi\""), "select a from b where x hastag \"hi\"");
AssertIR(Parse("select a from b where x tagged \"hi\""), "select a from b where x hastag \"hi\"");
AssertIR(Parse(R"(select a from b where x hastag "a\nb")"), R"(select a from b where x hastag "a\nb")");
AssertIR(Parse(R"(select a from b where x hastag "")"), R"(select a from b where x hastag "")");
AssertIR(Parse(R"(select a from b where x hastag "hello , hi")"), R"(select a from b where x hastag "hello , hi")");
Expand Down
Loading