diff options
author | Tor Egge <Tor.Egge@online.no> | 2023-11-22 15:16:47 +0100 |
---|---|---|
committer | Tor Egge <Tor.Egge@online.no> | 2023-11-22 15:16:47 +0100 |
commit | ec90d54ca208408952224413b41dc475443c3e36 (patch) | |
tree | 983129bc17c0ebdbd51bb2821ad1d073fcef4c17 /searchlib | |
parent | 07e8c4bee1bffd940bdc54bc093566f3d78961b7 (diff) |
Check for valid successor.
Diffstat (limited to 'searchlib')
-rw-r--r-- | searchlib/src/vespa/searchlib/attribute/dfa_fuzzy_matcher.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/searchlib/src/vespa/searchlib/attribute/dfa_fuzzy_matcher.h b/searchlib/src/vespa/searchlib/attribute/dfa_fuzzy_matcher.h index 9de77085fae..590d1997e57 100644 --- a/searchlib/src/vespa/searchlib/attribute/dfa_fuzzy_matcher.h +++ b/searchlib/src/vespa/searchlib/attribute/dfa_fuzzy_matcher.h @@ -23,6 +23,8 @@ private: uint32_t _prefix_size; bool _cased; + static constexpr uint32_t beyond_unicode = 0x110000; + const char* skip_prefix(const char* word) const; public: DfaFuzzyMatcher(std::string_view target, uint8_t max_edits, uint32_t prefix_size, bool cased, vespalib::fuzzy::LevenshteinDfa::DfaType dfa_type); @@ -47,7 +49,7 @@ public: return true; } _successor.resize(_prefix.size()); - _successor.emplace_back(1); + _successor.emplace_back(beyond_unicode); } else { _successor.resize(_prefix.size()); auto match = _dfa.match(word, _successor); @@ -63,6 +65,7 @@ public: } } DfaStringComparator cmp(data_store, _successor, _cased); + assert(cmp.less(itr.getKey().load_acquire(), vespalib::datastore::EntryRef())); itr.seek(vespalib::datastore::AtomicEntryRef(), cmp); return false; } |