Skip to content

Commit

Permalink
Fix the prefix Filter for (almost) EMPTY PREFIXES
Browse files Browse the repository at this point in the history
TODO: Apply the same fix for the other overload of transformToFirstPossibleBiggerValue
  • Loading branch information
joka921 committed Jul 20, 2021
1 parent 59a02f5 commit 6c31554
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/index/StringSortComparator.h
Original file line number Diff line number Diff line change
Expand Up @@ -605,11 +605,19 @@ class TripleComponentComparator {
std::string_view s, const Level level) const {
AD_CHECK(level == Level::PRIMARY)
auto transformed = extractAndTransformComparable(s, Level::PRIMARY);
unsigned char last = transformed.transformedVal.get().back();
if (last < std::numeric_limits<unsigned char>::max()) {
transformed.transformedVal.get().back() += 1;
AD_CHECK(static_cast<unsigned char>(transformed.firstOriginalChar) <
std::numeric_limits<unsigned char>::max())
if (transformed.transformedVal.get().empty()) {
transformed.firstOriginalChar += 1;
// transformed.transformedVal.get().push_back('\1');
} else {
transformed.transformedVal.get().push_back('\0');
unsigned char last = transformed.transformedVal.get().back();
if (last < std::numeric_limits<unsigned char>::max()) {
transformed.transformedVal.get().back() += 1;
} else {
// transformed.transformedVal.get().push_back('\1');
transformed.firstOriginalChar += 1;
}
}
return transformed;
}
Expand Down

0 comments on commit 6c31554

Please sign in to comment.