Skip to content

Open Source alternative to Algolia + Pinecone and an Easier-to-Use alternative to ElasticSearch ⚡ 🔍 ✨ Fast, typo tolerant, in-memory fuzzy Search Engine for building delightful search experiences

Fixed an edge case in filtering int64 values.

kishorenc50dba3ec43a9
diff --git a/src/index.cpp b/src/index.cpp
index 7e6f9ba1..109452f2 100644
--- a/src/index.cpp
+++ b/src/index.cpp
@@ -951,8 +951,8 @@ Option<uint32_t> Index::do_filtering(uint32_t** filter_ids_out, const std::vecto
if(f.type == field_types::INT32 || f.type == field_types::INT32_ARRAY) {
int32_t value = (int32_t) std::stoi(filter_value);
art_int32_search(t, value, a_filter.compare_operator, leaves);
- } else {
- int64_t value = (int64_t) std::stoi(filter_value);
+ } else { // int64
+ int64_t value = (int64_t) std::stol(filter_value);
art_int64_search(t, value, a_filter.compare_operator, leaves);
}
diff --git a/test/collection_test.cpp b/test/collection_test.cpp
index dfcfac39..f5c9bf09 100644
--- a/test/collection_test.cpp
+++ b/test/collection_test.cpp
@@ -1095,7 +1095,7 @@ TEST_F(CollectionTest, FilterOnNumericFields) {
}
// when filters don't match any record, no results should be returned
- results = coll_array_fields->search("Jeremy", query_fields, "timestamps:<1", facets, sort_fields, 0, 10, 1, FREQUENCY, false).get();
+ results = coll_array_fields->search("Jeremy", query_fields, "timestamps:>1591091288061", facets, sort_fields, 0, 10, 1, FREQUENCY, false).get();
ASSERT_EQ(0, results["hits"].size());
collectionManager.drop_collection("coll_array_fields");