Skip to content

Commit

Permalink
Restore the use of unidecode for in/ni operators (felt#212)
Browse files Browse the repository at this point in the history
* Restore the use of unidecode for in/ni operators

* Update changelog and version
  • Loading branch information
e-n-f authored Mar 8, 2024
1 parent 021bb96 commit 655eccf
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 2.50.0

* FSL-style "in" expressions use unidecode again

# 2.49.0

* FSL-style "in" expressions now allow numeric comparisons, but they no longer use unidecode to remove diacritics.
Expand Down
5 changes: 2 additions & 3 deletions evaluator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -387,16 +387,15 @@ static int eval(std::function<mvt_value(std::string const &)> feature, json_obje
if (f->value.array.array[2]->type == JSON_ARRAY &&
(strcmp(f->value.array.array[1]->value.string.string, "in") == 0 ||
strcmp(f->value.array.array[1]->value.string.string, "ni") == 0)) {
static std::vector<std::string> no_unidecode_data;
std::string s = mvt_value_to_string(lhs, fail, no_unidecode_data);
std::string s = mvt_value_to_string(lhs, fail, unidecode_data);
if (fail) {
return -1; // null in anything => false
}

bool contains = false;
for (size_t i = 0; i < f->value.array.array[2]->value.array.length; i++) {
fail = false;
int cmp = compare_fsl(ff, f->value.array.array[2]->value.array.array[i], fail, no_unidecode_data);
int cmp = compare_fsl(ff, f->value.array.array[2]->value.array.array[i], fail, unidecode_data);
if (fail) {
continue; // null
}
Expand Down
2 changes: 1 addition & 1 deletion version.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#ifndef VERSION_HPP
#define VERSION_HPP

#define VERSION "v2.49.0"
#define VERSION "v2.50.0"

#endif

0 comments on commit 655eccf

Please sign in to comment.