summaryrefslogtreecommitdiffstats
path: root/searchlib/src/tests/attribute/searchcontext/searchcontext_test.cpp
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/searchcontext/searchcontext_test.cpp
parentad7cc1d11f0c19baa2344a643377576c559555f7 (diff)
Propagating annotations for fuzzy query
Diffstat (limited to 'searchlib/src/tests/attribute/searchcontext/searchcontext_test.cpp')
-rw-r--r--searchlib/src/tests/attribute/searchcontext/searchcontext_test.cpp9
1 files changed, 8 insertions, 1 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);
}