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

updating regex for float and negative numbers

krunalb29a311f7a69
diff --git a/src/collection.cpp b/src/collection.cpp
index 23050d4d..fd7d7313 100644
--- a/src/collection.cpp
+++ b/src/collection.cpp
@@ -4870,7 +4870,7 @@ bool Collection::get_enable_nested_fields() {
Option<bool> Collection::parse_facet(const std::string& facet_field, std::vector<facet>& facets) const{
const std::regex base_pattern(".+\\(.*\\)");
- const std::regex range_pattern("[[a-zA-Z]+:\\[([0-9]+)\\,\\s*([0-9]+)\\]");
+ const std::regex range_pattern("[[a-zA-Z]+:\\[([+-]?([0-9]*[.])?[0-9]+)\\,\\s*([+-]?([0-9]*[.])?[0-9]+)\\]");
if(facet_field.find(":") != std::string::npos) { //range based facet
if(!std::regex_match(facet_field, base_pattern)){