aboutsummaryrefslogtreecommitdiffstats
path: root/searchcommon
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2021-04-08 16:12:02 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2021-04-08 16:12:02 +0000
commit384505ff39ab15c812d753853a7147e2c0440fca (patch)
treee5f5710343e746adddfdfcdc23ec19ffea9e5b4b /searchcommon
parent51371500d33d9f6fdf1c78cdca06a0e5e20dd283 (diff)
Wire in match config
Diffstat (limited to 'searchcommon')
-rw-r--r--searchcommon/src/tests/attribute/config/attribute_config_test.cpp8
-rw-r--r--searchcommon/src/vespa/searchcommon/common/dictionary_config.cpp31
-rw-r--r--searchcommon/src/vespa/searchcommon/common/dictionary_config.h14
3 files changed, 42 insertions, 11 deletions
diff --git a/searchcommon/src/tests/attribute/config/attribute_config_test.cpp b/searchcommon/src/tests/attribute/config/attribute_config_test.cpp
index 98b2bfe5c90..12a9837629d 100644
--- a/searchcommon/src/tests/attribute/config/attribute_config_test.cpp
+++ b/searchcommon/src/tests/attribute/config/attribute_config_test.cpp
@@ -111,10 +111,18 @@ TEST("Test GrowStrategy consistency") {
TEST("DictionaryConfig") {
using Type = DictionaryConfig::Type;
+ using Match = DictionaryConfig::Match;
EXPECT_EQUAL(Type::BTREE, DictionaryConfig().getType());
+ EXPECT_EQUAL(Match::UNCASED, DictionaryConfig().getMatch());
+
EXPECT_EQUAL(Type::BTREE, DictionaryConfig(Type::BTREE).getType());
+ EXPECT_EQUAL(Match::UNCASED, DictionaryConfig(Type::BTREE).getMatch());
+ EXPECT_EQUAL(Match::UNCASED, DictionaryConfig(Type::BTREE, Match::UNCASED).getMatch());
+ EXPECT_EQUAL(Match::CASED, DictionaryConfig(Type::BTREE, Match::CASED).getMatch());
+
EXPECT_EQUAL(Type::HASH, DictionaryConfig(Type::HASH).getType());
EXPECT_EQUAL(Type::BTREE_AND_HASH, DictionaryConfig(Type::BTREE_AND_HASH).getType());
+
EXPECT_EQUAL(DictionaryConfig(Type::BTREE), DictionaryConfig(Type::BTREE));
EXPECT_EQUAL(DictionaryConfig(Type::HASH), DictionaryConfig(Type::HASH));
EXPECT_EQUAL(DictionaryConfig(Type::BTREE_AND_HASH), DictionaryConfig(Type::BTREE_AND_HASH));
diff --git a/searchcommon/src/vespa/searchcommon/common/dictionary_config.cpp b/searchcommon/src/vespa/searchcommon/common/dictionary_config.cpp
index a6a0255f96d..0156a7f9d8c 100644
--- a/searchcommon/src/vespa/searchcommon/common/dictionary_config.cpp
+++ b/searchcommon/src/vespa/searchcommon/common/dictionary_config.cpp
@@ -8,13 +8,30 @@ namespace search {
std::ostream&
operator<<(std::ostream& os, const DictionaryConfig & cfg) {
- switch(cfg.getType()) {
- case DictionaryConfig::Type::BTREE:
- return os << "BTREE";
- case DictionaryConfig::Type::HASH:
- return os << "HASH";
- case DictionaryConfig::Type::BTREE_AND_HASH:
- return os << "BTREE_AND_HASH";
+ return os << cfg.getType() << "," << cfg.getMatch();
+}
+
+std::ostream&
+operator<<(std::ostream& os, DictionaryConfig::Type type) {
+
+ switch (type) {
+ case DictionaryConfig::Type::BTREE:
+ return os << "BTREE";
+ case DictionaryConfig::Type::HASH:
+ return os << "HASH";
+ case DictionaryConfig::Type::BTREE_AND_HASH:
+ return os << "BTREE_AND_HASH";
+ }
+ assert(false);
+}
+
+std::ostream&
+operator<<(std::ostream& os, DictionaryConfig::Match match) {
+ switch(match) {
+ case DictionaryConfig::Match::CASED:
+ return os << "CASE_SENSTITIVE";
+ case DictionaryConfig::Match::UNCASED:
+ return os << "CASE_INSENSTITIVE";
}
assert(false);
}
diff --git a/searchcommon/src/vespa/searchcommon/common/dictionary_config.h b/searchcommon/src/vespa/searchcommon/common/dictionary_config.h
index c35f7eaafef..b429b910d4e 100644
--- a/searchcommon/src/vespa/searchcommon/common/dictionary_config.h
+++ b/searchcommon/src/vespa/searchcommon/common/dictionary_config.h
@@ -12,14 +12,20 @@ namespace search {
class DictionaryConfig {
public:
enum class Type { BTREE, HASH, BTREE_AND_HASH };
- DictionaryConfig() noexcept : _type(Type::BTREE) {}
- DictionaryConfig(Type ordering) noexcept : _type(ordering) {}
+ enum class Match { CASED, UNCASED };
+ DictionaryConfig() noexcept : _type(Type::BTREE), _match(Match::UNCASED) {}
+ DictionaryConfig(Type type) noexcept : _type(type), _match(Match::UNCASED) {}
+ DictionaryConfig(Type type, Match match) noexcept : _type(type), _match(match) {}
Type getType() const { return _type; }
- bool operator == (const DictionaryConfig & b) const { return _type == b._type; }
+ Match getMatch() const { return _match; }
+ bool operator == (const DictionaryConfig & b) const { return (_type == b._type) && (_match == b._match); }
private:
- Type _type;
+ Type _type;
+ Match _match;
};
std::ostream& operator<<(std::ostream& os, const DictionaryConfig & cfg);
+std::ostream& operator<<(std::ostream& os, DictionaryConfig::Type type);
+std::ostream& operator<<(std::ostream& os, DictionaryConfig::Match match);
} // namespace search