mirror of
https://github.com/typesense/typesense.git
synced 2025-05-22 23:06:30 +08:00
Fix Index::get_filter_matches
.
This commit is contained in:
parent
a3d79062ad
commit
3b2f42e1bc
@ -2024,9 +2024,6 @@ void Index::get_filter_matches(filter_node_t* const root, std::vector<std::pair<
|
||||
return;
|
||||
}
|
||||
|
||||
get_filter_matches(root->left, vec);
|
||||
get_filter_matches(root->right, vec);
|
||||
|
||||
if (root->isOperator && root->filter_operator == OR) {
|
||||
uint32_t* l_filter_ids = nullptr;
|
||||
uint32_t l_filter_ids_length = 0;
|
||||
@ -2052,7 +2049,8 @@ void Index::get_filter_matches(filter_node_t* const root, std::vector<std::pair<
|
||||
do_filtering(root);
|
||||
vec.emplace_back(root->match_index_ids.first, root);
|
||||
} else {
|
||||
// malformed
|
||||
get_filter_matches(root->left, vec);
|
||||
get_filter_matches(root->right, vec);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2590,17 +2590,17 @@ TEST_F(CollectionFilteringTest, ComplexFilterQuery) {
|
||||
ASSERT_STREQ(id.c_str(), result_id.c_str());
|
||||
}
|
||||
|
||||
// results = coll->search("Jeremy", {"name"}, "years:>2000 && ((age:<30 && rating:>5) || (age:>50 && rating:<5))",
|
||||
// {}, sort_fields_desc, {0}, 10, 1, FREQUENCY, {false}).get();
|
||||
// ASSERT_EQ(1, results["hits"].size());
|
||||
//
|
||||
// ids = {"2"};
|
||||
// for (size_t i = 0; i < results["hits"].size(); i++) {
|
||||
// nlohmann::json result = results["hits"].at(i);
|
||||
// std::string result_id = result["document"]["id"];
|
||||
// std::string id = ids.at(i);
|
||||
// ASSERT_STREQ(id.c_str(), result_id.c_str());
|
||||
// }
|
||||
results = coll->search("Jeremy", {"name"}, "years:>2000 && ((age:<30 && rating:>5) || (age:>50 && rating:<5))",
|
||||
{}, sort_fields_desc, {0}, 10, 1, FREQUENCY, {false}).get();
|
||||
ASSERT_EQ(1, results["hits"].size());
|
||||
|
||||
ids = {"2"};
|
||||
for (size_t i = 0; i < results["hits"].size(); i++) {
|
||||
nlohmann::json result = results["hits"].at(i);
|
||||
std::string result_id = result["document"]["id"];
|
||||
std::string id = ids.at(i);
|
||||
ASSERT_STREQ(id.c_str(), result_id.c_str());
|
||||
}
|
||||
|
||||
collectionManager.drop_collection("ComplexFilterQueryCollection");
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user