summaryrefslogtreecommitdiffstats
path: root/searchlib/src/tests/attribute
diff options
context:
space:
mode:
authorAlexey Chernyshev <aleksei@spotify.com>2022-04-04 16:23:07 +0200
committerAlexey Chernyshev <aleksei@spotify.com>2022-04-07 14:44:30 +0200
commit7e9b33401201db9a9e22971dd419247e268bbfaa (patch)
treef5032a82e9fa74247b2fdeb3dcde4dc6cf98ce89 /searchlib/src/tests/attribute
parentad7cc1d11f0c19baa2344a643377576c559555f7 (diff)
Propagating annotations for fuzzy query
Diffstat (limited to 'searchlib/src/tests/attribute')
-rw-r--r--searchlib/src/tests/attribute/searchcontext/searchcontext_test.cpp9
-rw-r--r--searchlib/src/tests/attribute/stringattribute/stringattribute_test.cpp4
2 files changed, 10 insertions, 3 deletions
diff --git a/searchlib/src/tests/attribute/searchcontext/searchcontext_test.cpp b/searchlib/src/tests/attribute/searchcontext/searchcontext_test.cpp
index aa64e944baa..947e4aa30c2 100644
--- a/searchlib/src/tests/attribute/searchcontext/searchcontext_test.cpp
+++ b/searchlib/src/tests/attribute/searchcontext/searchcontext_test.cpp
@@ -402,7 +402,8 @@ SearchContextTest::buildTermQuery(std::vector<char> & buffer, const vespalib::st
{
uint32_t indexLen = index.size();
uint32_t termLen = term.size();
- uint32_t queryPacketSize = 1 + 2 * 4 + indexLen + termLen;
+ uint32_t fuzzyParametersSize = (termType == TermType::FUZZYTERM) ? 8 : 0;
+ uint32_t queryPacketSize = 1 + 2 * 4 + indexLen + termLen + fuzzyParametersSize;
uint32_t p = 0;
buffer.resize(queryPacketSize);
switch (termType) {
@@ -419,6 +420,12 @@ SearchContextTest::buildTermQuery(std::vector<char> & buffer, const vespalib::st
p += vespalib::compress::Integer::compressPositive(termLen, &buffer[p]);
memcpy(&buffer[p], term.c_str(), termLen);
p += termLen;
+
+ if (termType == TermType::FUZZYTERM) {
+ p += vespalib::compress::Integer::compressPositive(2, &buffer[p]); // max edit distance
+ p += vespalib::compress::Integer::compressPositive(0, &buffer[p]); // prefix length
+ }
+
buffer.resize(p);
}
diff --git a/searchlib/src/tests/attribute/stringattribute/stringattribute_test.cpp b/searchlib/src/tests/attribute/stringattribute/stringattribute_test.cpp
index 1f570e0a381..4deb287df0e 100644
--- a/searchlib/src/tests/attribute/stringattribute/stringattribute_test.cpp
+++ b/searchlib/src/tests/attribute/stringattribute/stringattribute_test.cpp
@@ -388,8 +388,8 @@ testSingleValue(Attribute & svsa, Config &cfg)
TEST("testSingleValue")
{
EXPECT_EQUAL(24u, sizeof(SearchContext));
- EXPECT_EQUAL(56u, sizeof(StringSearchHelper));
- EXPECT_EQUAL(104u, sizeof(attribute::SingleStringEnumSearchContext));
+ EXPECT_EQUAL(88u, sizeof(StringSearchHelper));
+ EXPECT_EQUAL(136u, sizeof(attribute::SingleStringEnumSearchContext));
{
Config cfg(BasicType::STRING, CollectionType::SINGLE);
SingleValueStringAttribute svsa("svsa", cfg);