mirror of
https://github.com/dragonflydb/dragonfly.git
synced 2025-05-11 18:35:46 +02:00
fix(jsonpath): Add JsonPath grammar for the child identifier in brackets (#3533)
* fix(jsonpath): Add json path grammar for the child identifier with brackets fixes dragonflydb##3511 --------- Signed-off-by: Stepan Bagritsevich <bagr.stepan@gmail.com>
This commit is contained in:
parent
822a8fddc9
commit
6cfbc08013
5 changed files with 138 additions and 4 deletions
|
@ -250,6 +250,20 @@ TEST_F(SearchFamilyTest, JsonAttributesPaths) {
|
|||
EXPECT_THAT(Run({"ft.search", "i1", "yes"}), AreDocIds("k2"));
|
||||
}
|
||||
|
||||
TEST_F(SearchFamilyTest, JsonIdentifierWithBrackets) {
|
||||
Run({"json.set", "k1", ".", R"({"name":"London","population":8.8,"continent":"Europe"})"});
|
||||
Run({"json.set", "k2", ".", R"({"name":"Athens","population":3.1,"continent":"Europe"})"});
|
||||
Run({"json.set", "k3", ".", R"({"name":"Tel-Aviv","population":1.3,"continent":"Asia"})"});
|
||||
Run({"json.set", "k4", ".", R"({"name":"Hyderabad","population":9.8,"continent":"Asia"})"});
|
||||
|
||||
EXPECT_EQ(Run({"ft.create", "i1", "on", "json", "schema", "$[\"name\"]", "as", "name", "tag",
|
||||
"$[\"population\"]", "as", "population", "numeric", "sortable", "$[\"continent\"]",
|
||||
"as", "continent", "tag"}),
|
||||
"OK");
|
||||
|
||||
EXPECT_THAT(Run({"ft.search", "i1", "(@continent:{Europe})"}), AreDocIds("k1", "k2"));
|
||||
}
|
||||
|
||||
// todo: fails on arm build
|
||||
#ifndef SANITIZERS
|
||||
TEST_F(SearchFamilyTest, JsonArrayValues) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue