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
C++ algoliadatastoreelasticsearchenterprise-searchfacetingfull-text-searchfuzzy-searchgeosearchin-memoryinstantsearchmerchandisingpineconesearchsearch-enginesemantic-searchsimilarity-searchsite-searchsynonymstypo-tolerancevector-search
Allow spaces in range facet string.
Kishore Nallanf0b90c114f62
diff --git a/src/collection.cpp b/src/collection.cppindex 90ca8b1a..cc35fb69 100644--- a/src/collection.cpp+++ b/src/collection.cpp@@ -4535,7 +4535,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]+)\\, ([0-9]+)\\]");+ const std::regex range_pattern("[[a-zA-Z]+:\\[([0-9]+)\\,\\s*([0-9]+)\\]");if(facet_field.find(":") != std::string::npos) { //range based facetif(!std::regex_match(facet_field, base_pattern)){diff --git a/test/collection_faceting_test.cpp b/test/collection_faceting_test.cppindex 9b4e54a9..41f2f79b 100644--- a/test/collection_faceting_test.cpp+++ b/test/collection_faceting_test.cpp@@ -1130,9 +1130,10 @@ TEST_F(CollectionFacetingTest, FacetParseTest){ASSERT_TRUE(expected.count(wildcard_facets[i].field_name) == 1);}+ // should also allow zero or more spaces after ","std::vector<std::string> mixed_facet_fields {"score",- "grade(A:[80, 100], B:[60, 80], C:[40, 60])",+ "grade(A:[80, 100], B:[60, 80], C:[40,60])","ra*",};