mirror of
https://github.com/typesense/typesense.git
synced 2025-05-21 06:02:26 +08:00
Fix edge case with ID-based filtering.
When no IDs match, no results should be found.
This commit is contained in:
parent
644eefbad3
commit
dbb688254e
@ -114,9 +114,7 @@ Option<bool> filter::parse_filter_query(const string& simple_filter_query,
|
||||
}
|
||||
}
|
||||
|
||||
if(!id_filter.values.empty()) {
|
||||
filters.push_back(id_filter);
|
||||
}
|
||||
filters.push_back(id_filter);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
@ -1524,6 +1524,19 @@ TEST_F(CollectionFilteringTest, FilteringViaDocumentIds) {
|
||||
ASSERT_STREQ("125", results["hits"][1]["document"]["id"].get<std::string>().c_str());
|
||||
ASSERT_STREQ("127", results["hits"][2]["document"]["id"].get<std::string>().c_str());
|
||||
|
||||
// when no IDs exist
|
||||
results = coll1->search("*",
|
||||
{}, "id: [1000] && num_employees: <300",
|
||||
{}, sort_fields, {0}, 10, 1, FREQUENCY, {true}).get();
|
||||
|
||||
ASSERT_EQ(0, results["found"].get<size_t>());
|
||||
|
||||
results = coll1->search("*",
|
||||
{}, "id: 1000",
|
||||
{}, sort_fields, {0}, 10, 1, FREQUENCY, {true}).get();
|
||||
|
||||
ASSERT_EQ(0, results["found"].get<size_t>());
|
||||
|
||||
collectionManager.drop_collection("coll1");
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user