summaryrefslogtreecommitdiffstats
path: root/vespalib
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2022-10-17 17:19:43 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2022-10-17 17:27:08 +0000
commita13c1f486ea9470a72a5dd564929216370f91951 (patch)
tree4bb3c9283a3035846ef2691cadcd0d0dcb0487b1 /vespalib
parent169187771dfc974f58238fc19db3b534c4b6c9f4 (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.cpp2
-rw-r--r--vespalib/src/vespa/vespalib/fuzzy/fuzzy_matcher.h11
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);
-
};
}