aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--searchsummary/src/tests/juniper/auxTest.cpp18
-rw-r--r--searchsummary/src/tests/juniper/matchobjectTest.cpp10
-rw-r--r--searchsummary/src/tests/juniper/mcandTest.cpp28
-rw-r--r--searchsummary/src/vespa/juniper/rpinterface.cpp2
-rw-r--r--searchsummary/src/vespa/juniper/rpinterface.h4
-rw-r--r--searchsummary/src/vespa/searchsummary/docsummary/docsumconfig.cpp3
-rw-r--r--searchsummary/src/vespa/searchsummary/docsummary/dynamicteaserdfw.cpp30
-rw-r--r--searchsummary/src/vespa/searchsummary/docsummary/juniperdfw.h22
8 files changed, 49 insertions, 68 deletions
diff --git a/searchsummary/src/tests/juniper/auxTest.cpp b/searchsummary/src/tests/juniper/auxTest.cpp
index c42cf4ccd83..d4b65858e3e 100644
--- a/searchsummary/src/tests/juniper/auxTest.cpp
+++ b/searchsummary/src/tests/juniper/auxTest.cpp
@@ -137,7 +137,7 @@ AuxTest::TestDoubleWidth()
juniper::QueryParser q("\xef\xbd\x93\xef\xbd\x8f\xef\xbd\x8e\xef\xbd\x99");
juniper::QueryHandle qh(q, nullptr, juniper.getModifier());
auto res = juniper::Analyse(myConfig, qh,
- input, 17, 0, 0, 0);
+ input, 17, 0, 0);
_test(static_cast<bool>(res));
juniper::Summary* sum = juniper::GetTeaser(*res, nullptr);
@@ -175,7 +175,7 @@ AuxTest::TestPartialUTF8()
juniper::QueryParser q("ipod");
juniper::QueryHandle qh(q, nullptr, juniper.getModifier());
auto res = juniper::Analyse(myConfig, qh,
- input, inputSize, 0, 0, 0);
+ input, inputSize, 0, 0);
_test(static_cast<bool>(res));
juniper::Summary* sum = juniper::GetTeaser(*res, nullptr);
@@ -213,7 +213,7 @@ void AuxTest::TestLargeBlockChinese()
juniper::QueryParser q("希望");
juniper::QueryHandle qh(q, nullptr, juniper.getModifier());
auto res = juniper::Analyse(myConfig, qh,
- input, inputSize, 0, 0, 0);
+ input, inputSize, 0, 0);
_test(static_cast<bool>(res));
juniper::Summary* sum = juniper::GetTeaser(*res, nullptr);
@@ -238,7 +238,7 @@ void AuxTest::TestExample()
int content_len = strlen(content);
auto res = juniper::Analyse(*juniper::TestConfig, qh,
content, content_len,
- 0, 0, 0);
+ 0, 0);
_test(static_cast<bool>(res));
res->Scan();
@@ -402,7 +402,7 @@ void AuxTest::TestUTF8context()
s.append(char_from_u8(u8" beste forekomst av s\u00f8ket med s\u00f8kemotor til brukeren blir det enda bedre. "));
s.append(char_from_u8(u8"Hvis bare UTF8-kodingen virker som den skal for tegn som tar mer enn \u00e9n byte."));
- auto res = juniper::Analyse(*juniper::TestConfig, qh, s.c_str(), s.size(), 0, 0, 0);
+ auto res = juniper::Analyse(*juniper::TestConfig, qh, s.c_str(), s.size(), 0, 0);
_test(static_cast<bool>(res));
size_t charsize;
@@ -484,7 +484,7 @@ void AuxTest::TestJapanese()
int content_len = strlen(content);
auto res = juniper::Analyse(*juniper::TestConfig, qh,
content, content_len,
- 0, 0, 0);
+ 0, 0);
_test(static_cast<bool>(res));
size_t charsize;
@@ -574,7 +574,7 @@ void AuxTest::TestStartHits()
int content_len = strlen(content);
auto res = juniper::Analyse(*juniper::TestConfig, qh,
content, content_len,
- 0, 0, 0);
+ 0, 0);
_test(static_cast<bool>(res));
juniper::Summary* sum = juniper::GetTeaser(*res, nullptr);
@@ -598,7 +598,7 @@ void AuxTest::TestEndHit()
auto res = juniper::Analyse(*juniper::TestConfig, qh,
content, content_len,
- 0, 0, 0);
+ 0, 0);
_test(static_cast<bool>(res));
juniper::Summary* sum = juniper::GetTeaser(*res, nullptr);
@@ -868,7 +868,7 @@ AuxTest::TestWhiteSpacePreserved()
juniper::QueryParser q("best");
juniper::QueryHandle qh(q, nullptr, juniper.getModifier());
- auto res = juniper::Analyse(myConfig, qh, input.c_str(), input.size(), 0, 0, 0);
+ auto res = juniper::Analyse(myConfig, qh, input.c_str(), input.size(), 0, 0);
_test(static_cast<bool>(res));
juniper::Summary* sum = juniper::GetTeaser(*res, nullptr);
diff --git a/searchsummary/src/tests/juniper/matchobjectTest.cpp b/searchsummary/src/tests/juniper/matchobjectTest.cpp
index d8b7724d8a5..f1dc9f81e4a 100644
--- a/searchsummary/src/tests/juniper/matchobjectTest.cpp
+++ b/searchsummary/src/tests/juniper/matchobjectTest.cpp
@@ -30,7 +30,7 @@ void MatchObjectTest::testTerm() {
// Fetch a result descriptor:
auto res = juniper::Analyse(*juniper::TestConfig, q._qhandle,
content, content_len,
- 0, 0, 0);
+ 0, 0);
_test(static_cast<bool>(res));
// Do the scanning manually. This calls accept several times
@@ -47,10 +47,10 @@ void MatchObjectTest::testTerm() {
TestQuery q2("*ea*");
TestQuery q3("*d");
TestQuery q4("*word");
- auto r1 = juniper::Analyse(*juniper::TestConfig, q1._qhandle, content, content_len, 0, 0, 0);
- auto r2 = juniper::Analyse(*juniper::TestConfig, q2._qhandle, content, content_len, 0, 0, 0);
- auto r3 = juniper::Analyse(*juniper::TestConfig, q3._qhandle, content, content_len, 0, 0, 0);
- auto r4 = juniper::Analyse(*juniper::TestConfig, q4._qhandle, content, content_len, 0, 0, 0);
+ auto r1 = juniper::Analyse(*juniper::TestConfig, q1._qhandle, content, content_len, 0, 0);
+ auto r2 = juniper::Analyse(*juniper::TestConfig, q2._qhandle, content, content_len, 0, 0);
+ auto r3 = juniper::Analyse(*juniper::TestConfig, q3._qhandle, content, content_len, 0, 0);
+ auto r4 = juniper::Analyse(*juniper::TestConfig, q4._qhandle, content, content_len, 0, 0);
_test(static_cast<bool>(r1));
if (r1) {
r1->Scan();
diff --git a/searchsummary/src/tests/juniper/mcandTest.cpp b/searchsummary/src/tests/juniper/mcandTest.cpp
index 46bd4a5196f..43d34539ddf 100644
--- a/searchsummary/src/tests/juniper/mcandTest.cpp
+++ b/searchsummary/src/tests/juniper/mcandTest.cpp
@@ -44,7 +44,7 @@ void MatchCandidateTest::testLog() {
auto res = juniper::Analyse(*juniper::TestConfig,
q._qhandle,
content.c_str(), content.size(),
- 0, 0, 0);
+ 0, 0);
_test(static_cast<bool>(res)); // We get a result handle
_test(!res->_mo); // but it is empty
@@ -72,7 +72,7 @@ void MatchCandidateTest::testDump() {
auto res = juniper::Analyse(*juniper::TestConfig,
q._qhandle,
content.c_str(), content.size(),
- 0, 0, 0);
+ 0, 0);
_test(static_cast<bool>(res));
long relevance = juniper::GetRelevancy(*res);
// zero value since there are no hits and constraints are enabled..
@@ -84,7 +84,7 @@ void MatchCandidateTest::testDump() {
auto res = juniper::Analyse(*juniper::TestConfig,
q._qhandle,
content.c_str(), content.size(),
- 0, 0, 0);
+ 0, 0);
_test(static_cast<bool>(res));
long relevance = juniper::GetRelevancy(*res);
// Check that X_CONSTR propagates as intended
@@ -96,7 +96,7 @@ void MatchCandidateTest::testDump() {
auto res = juniper::Analyse(*juniper::TestConfig,
q._qhandle,
content.c_str(), content.size(),
- 0, 0, 0);
+ 0, 0);
_test(static_cast<bool>(res));
long relevance = juniper::GetRelevancy(*res);
// constant value since there are no hits but this is
@@ -109,7 +109,7 @@ void MatchCandidateTest::testDump() {
auto res = juniper::Analyse(*juniper::TestConfig,
q._qhandle,
content.c_str(), content.size(),
- 0, 0, 0);
+ 0, 0);
_test(static_cast<bool>(res));
long relevance = juniper::GetRelevancy(*res);
// Relevance may change, but nice to discover such changes..
@@ -133,7 +133,7 @@ void MatchCandidateTest::testorder() {
auto res = juniper::Analyse(*juniper::TestConfig,
q._qhandle,
content, content_len,
- 0, 0, 0);
+ 0, 0);
_test(static_cast<bool>(res));
// Do the scanning manually. Scan calls accept several times
@@ -162,7 +162,7 @@ void MatchCandidateTest::testMatches_limit() {
auto res = juniper::Analyse(*juniper::TestConfig,
q._qhandle,
content, content_len,
- 0, 0, 0);
+ 0, 0);
_test(static_cast<bool>(res));
// Do the scanning manually. This calls accept several times
@@ -196,7 +196,7 @@ void MatchCandidateTest::testAccept() {
auto res = juniper::Analyse(*juniper::TestConfig,
q._qhandle,
content, content_len,
- 0, 0, 0);
+ 0, 0);
_test(static_cast<bool>(res));
// Do the scanning manually. This calls accept several times
@@ -254,7 +254,7 @@ void MatchCandidateTest::testMake_keylist() {
auto res = juniper::Analyse(*juniper::TestConfig,
q._qhandle,
content, content_len,
- 0, 0, 0);
+ 0, 0);
_test(static_cast<bool>(res));
// Do the scanning manually. This calls accept several times
@@ -283,7 +283,7 @@ void MatchCandidateTest::testAdd_to_keylist() {
auto res = juniper::Analyse(*juniper::TestConfig,
q._qhandle,
content, content_len,
- 0, 0, 0);
+ 0, 0);
_test(static_cast<bool>(res));
// Do the scanning manually. This calls accept several times
@@ -321,7 +321,7 @@ void MatchCandidateTest::testLength() {
// Fetch a result descriptor:
auto res = juniper::Analyse(*juniper::TestConfig, q._qhandle,
content, content_len,
- 0, 0, 0);
+ 0, 0);
juniper::Summary* sum = juniper::GetTeaser(*res);
Matcher& m = *res->_matcher;
@@ -343,7 +343,7 @@ void MatchCandidateTest::testLength() {
auto res = juniper::Analyse(*juniper::TestConfig,
q._qhandle
,content, content_len,
- 0, 0, 0);
+ 0, 0);
res->Scan();
Matcher& m = *res->_matcher;
@@ -360,7 +360,7 @@ void MatchCandidateTest::testLength() {
// Fetch a result descriptor:
auto res = juniper::Analyse(*juniper::TestConfig, q._qhandle,
content, content_len,
- 0, 0, 0);
+ 0, 0);
res->Scan();
Matcher& m = *res->_matcher;
@@ -403,7 +403,7 @@ void MatchCandidateTest::requireThatMaxNumberOfMatchCandidatesCanBeControlled()
auto res = juniper::Analyse(*juniper::TestConfig,
q._qhandle,
content, content_len,
- 0, 0, 0);
+ 0, 0);
_test(static_cast<bool>(res));
// Deflect tokens to my processor
diff --git a/searchsummary/src/vespa/juniper/rpinterface.cpp b/searchsummary/src/vespa/juniper/rpinterface.cpp
index de4b4cd3ef0..c54ae654ec7 100644
--- a/searchsummary/src/vespa/juniper/rpinterface.cpp
+++ b/searchsummary/src/vespa/juniper/rpinterface.cpp
@@ -96,7 +96,7 @@ void Juniper::FlushRewriters()
std::unique_ptr<Result> Analyse(const Config& config, QueryHandle& qhandle,
const char* docsum, size_t docsum_len,
- uint32_t docid, uint32_t /* inputfield_id */,
+ uint32_t docid,
uint32_t langid)
{
LOG(debug, "juniper::Analyse(): docId(%u), docsumLen(%zu), docsum(%s), langId(%u)",
diff --git a/searchsummary/src/vespa/juniper/rpinterface.h b/searchsummary/src/vespa/juniper/rpinterface.h
index d4ef5c5ebed..ee1f4e3a3d8 100644
--- a/searchsummary/src/vespa/juniper/rpinterface.h
+++ b/searchsummary/src/vespa/juniper/rpinterface.h
@@ -161,15 +161,13 @@ bool AnalyseCompatible(Config* conf1, Config* conf2);
* @param docsum_len The length in bytes of the document summary, including
any meta information.
* @param docid A 32 bit number uniquely identifying the document to be analysed
- * @param inputfield_id A 32 bit number uniquely identifying the summary field
- within the document that contains the provided document summary.
* @param langid A unique 32 bit id representing the language which
this document summary is to be analysed in context of.
* @return A unique pointer to a Result
*/
std::unique_ptr<Result> Analyse(const Config& config, QueryHandle& query,
const char* docsum, size_t docsum_len,
- uint32_t docid, uint32_t inputfield_id,
+ uint32_t docid,
uint32_t langid);
/** Get the computed relevancy of the processed content from the result.
diff --git a/searchsummary/src/vespa/searchsummary/docsummary/docsumconfig.cpp b/searchsummary/src/vespa/searchsummary/docsummary/docsumconfig.cpp
index 8dbd35af36e..8bdb1528cdf 100644
--- a/searchsummary/src/vespa/searchsummary/docsummary/docsumconfig.cpp
+++ b/searchsummary/src/vespa/searchsummary/docsummary/docsumconfig.cpp
@@ -35,11 +35,10 @@ DynamicDocsumConfig::createFieldWriter(const string & fieldName, const string &
std::unique_ptr<DocsumFieldWriter> fieldWriter;
if (overrideName == "dynamicteaser") {
if ( ! argument.empty() ) {
- const char *langFieldName = "something unused";
auto fw = std::make_unique<DynamicTeaserDFW>(getEnvironment()->getJuniper());
auto fw_ptr = fw.get();
fieldWriter = std::move(fw);
- rc = fw_ptr->Init(fieldName.c_str(), langFieldName, resultConfig, argument.c_str());
+ rc = fw_ptr->Init(fieldName.c_str(), argument);
} else {
throw IllegalArgumentException("Missing argument");
}
diff --git a/searchsummary/src/vespa/searchsummary/docsummary/dynamicteaserdfw.cpp b/searchsummary/src/vespa/searchsummary/docsummary/dynamicteaserdfw.cpp
index b3278724ff7..f7762408904 100644
--- a/searchsummary/src/vespa/searchsummary/docsummary/dynamicteaserdfw.cpp
+++ b/searchsummary/src/vespa/searchsummary/docsummary/dynamicteaserdfw.cpp
@@ -11,6 +11,7 @@
#include <vespa/juniper/config.h>
#include <vespa/juniper/queryhandle.h>
#include <vespa/juniper/result.h>
+#include <vespa/vespalib/data/slime/inserter.h>
#include <sstream>
#include <vespa/log/log.h>
@@ -286,10 +287,8 @@ JuniperQueryAdapter::Traverse(juniper::IQueryVisitor *v) const
}
JuniperDFW::JuniperDFW(juniper::Juniper * juniper)
- : _inputFieldEnumValue(static_cast<uint32_t>(-1)),
- _input_field_name(),
+ : _input_field_name(),
_juniperConfig(),
- _langFieldEnumValue(static_cast<uint32_t>(-1)),
_juniper(juniper)
{
}
@@ -300,38 +299,25 @@ JuniperDFW::~JuniperDFW() = default;
bool
JuniperDFW::Init(
const char *fieldName,
- const char *langFieldName,
- const ResultConfig & config,
- const char *inputField)
+ const vespalib::string& inputField)
{
bool rc = true;
- const util::StringEnum & enums(config.GetFieldNameEnum());
- if (langFieldName != nullptr)
- _langFieldEnumValue = enums.Lookup(langFieldName);
_juniperConfig = _juniper->CreateConfig(fieldName);
if (_juniperConfig.get() == nullptr) {
LOG(warning, "could not create juniper config for field '%s'", fieldName);
rc = false;
}
- _inputFieldEnumValue = enums.Lookup(inputField);
_input_field_name = inputField;
-
- if (_inputFieldEnumValue >= enums.GetNumEntries()) {
- LOG(warning, "no docsum format contains field '%s'; dynamic teasers will be empty",
- inputField);
- }
return rc;
}
bool
JuniperTeaserDFW::Init(
const char *fieldName,
- const char *langFieldName,
- const ResultConfig & config,
- const char *inputField)
+ const vespalib::string& inputField)
{
- return JuniperDFW::Init(fieldName, langFieldName, config, inputField);
+ return JuniperDFW::Init(fieldName, inputField);
}
vespalib::string
@@ -344,8 +330,8 @@ DynamicTeaserDFW::makeDynamicTeaser(uint32_t docid, vespalib::stringref input, G
state->_dynteaser._query = _juniper->CreateQueryHandle(iq, nullptr);
}
- LOG(debug, "makeDynamicTeaser: docid (%d), fieldenum (%d), lang (%d)",
- docid, _inputFieldEnumValue, _langFieldEnumValue);
+ LOG(debug, "makeDynamicTeaser: docid (%d)",
+ docid);
std::unique_ptr<juniper::Result> result;
@@ -361,7 +347,7 @@ DynamicTeaserDFW::makeDynamicTeaser(uint32_t docid, vespalib::stringref input, G
auto langid = static_cast<uint32_t>(-1);
result = juniper::Analyse(*_juniperConfig, *state->_dynteaser._query,
- input.data(), input.length(), docid, _inputFieldEnumValue, langid);
+ input.data(), input.length(), docid, langid);
}
juniper::Summary *teaser = result
diff --git a/searchsummary/src/vespa/searchsummary/docsummary/juniperdfw.h b/searchsummary/src/vespa/searchsummary/docsummary/juniperdfw.h
index 631ed374df2..fb31591e6d6 100644
--- a/searchsummary/src/vespa/searchsummary/docsummary/juniperdfw.h
+++ b/searchsummary/src/vespa/searchsummary/docsummary/juniperdfw.h
@@ -2,12 +2,14 @@
#pragma once
-#include "resultconfig.h"
#include "docsum_field_writer.h"
-#include "juniper_input.h"
-#include <vespa/searchlib/util/rawbuf.h>
-#include <vespa/vespalib/data/slime/inserter.h>
-#include <vespa/juniper/rpinterface.h>
+#include <memory>
+
+namespace juniper {
+class Config;
+class Juniper;
+}
+namespace vespalib::slime { struct Inserter; }
namespace search::docsummary {
@@ -16,17 +18,13 @@ class JuniperDFW : public DocsumFieldWriter
public:
virtual bool Init(
const char *fieldName,
- const char *langFieldName,
- const ResultConfig & config,
- const char *inputField);
+ const vespalib::string& inputField);
protected:
JuniperDFW(juniper::Juniper * juniper);
~JuniperDFW() override;
- uint32_t _inputFieldEnumValue;
vespalib::string _input_field_name;
std::unique_ptr<juniper::Config> _juniperConfig;
- uint32_t _langFieldEnumValue;
juniper::Juniper *_juniper;
private:
bool IsGenerated() const override { return false; }
@@ -38,8 +36,8 @@ private:
class JuniperTeaserDFW : public JuniperDFW
{
public:
- bool Init(const char *fieldName, const char *langFieldName,
- const ResultConfig & config, const char *inputField) override;
+ bool Init(const char *fieldName,
+ const vespalib::string& inputField) override;
protected:
JuniperTeaserDFW(juniper::Juniper * juniper) : JuniperDFW(juniper) { }
};