mirror of
https://github.com/typesense/typesense.git
synced 2025-05-18 20:52:50 +08:00
Allow spaces in range facet string.
This commit is contained in:
parent
7515e733db
commit
f0b90c114f
@ -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 facet
|
||||
if(!std::regex_match(facet_field, base_pattern)){
|
||||
|
@ -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*",
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user