diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2022-10-17 17:19:43 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2022-10-17 17:27:08 +0000 |
commit | a13c1f486ea9470a72a5dd564929216370f91951 (patch) | |
tree | 4bb3c9283a3035846ef2691cadcd0d0dcb0487b1 /vespalib | |
parent | 169187771dfc974f58238fc19db3b534c4b6c9f4 (diff) |
- Use unique_ptr to hide FuzzyMatcher to make most common SearchContext smaller.
- GC unused stringattribute files.
Diffstat (limited to 'vespalib')
-rw-r--r-- | vespalib/src/vespa/vespalib/fuzzy/fuzzy_matcher.cpp | 2 | ||||
-rw-r--r-- | vespalib/src/vespa/vespalib/fuzzy/fuzzy_matcher.h | 11 |
2 files changed, 6 insertions, 7 deletions
diff --git a/vespalib/src/vespa/vespalib/fuzzy/fuzzy_matcher.cpp b/vespalib/src/vespa/vespalib/fuzzy/fuzzy_matcher.cpp index a4bf0453f51..ff0ea1a94c0 100644 --- a/vespalib/src/vespa/vespalib/fuzzy/fuzzy_matcher.cpp +++ b/vespalib/src/vespa/vespalib/fuzzy/fuzzy_matcher.cpp @@ -38,6 +38,8 @@ vespalib::FuzzyMatcher::FuzzyMatcher(std::string_view term, uint32_t max_edit_di _folded_term_codepoints_suffix(get_suffix(_folded_term_codepoints, _prefix_size)) {} +vespalib::FuzzyMatcher::~FuzzyMatcher() = default; + std::span<const uint32_t> vespalib::FuzzyMatcher::get_prefix(const std::vector<uint32_t>& termCodepoints, uint32_t prefixLength) { if (prefixLength == 0 || termCodepoints.empty()) { return {}; diff --git a/vespalib/src/vespa/vespalib/fuzzy/fuzzy_matcher.h b/vespalib/src/vespa/vespalib/fuzzy/fuzzy_matcher.h index dcebc56babb..48098f83456 100644 --- a/vespalib/src/vespa/vespalib/fuzzy/fuzzy_matcher.h +++ b/vespalib/src/vespa/vespalib/fuzzy/fuzzy_matcher.h @@ -1,12 +1,10 @@ // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include <string_view> +#include <vespa/vespalib/stllike/string.h> #include <vector> #include <span> -#include <vespa/vespalib/stllike/string.h> - namespace vespalib { /** @@ -34,17 +32,16 @@ private: public: FuzzyMatcher(); - + FuzzyMatcher(const FuzzyMatcher &) = delete; + FuzzyMatcher & operator = (const FuzzyMatcher &) = delete; FuzzyMatcher(std::string_view term, uint32_t max_edit_distance, uint32_t prefix_size, bool is_cased); + ~FuzzyMatcher(); [[nodiscard]] bool isMatch(std::string_view target) const; - [[nodiscard]] vespalib::string getPrefix() const; static std::span<const uint32_t> get_prefix(const std::vector<uint32_t>& termCodepoints, uint32_t prefixLength); - static std::span<const uint32_t> get_suffix(const std::vector<uint32_t>& termCodepoints, uint32_t prefixLength); - }; } |