summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt37
-rw-r--r--ann_benchmark/src/vespa/ann_benchmark/vespa_ann_benchmark.cpp2
-rw-r--r--client/CMakeLists.txt14
-rw-r--r--client/go/.gitignore1
-rw-r--r--client/go/Makefile3
-rw-r--r--document/src/vespa/document/datatype/datatype.cpp2
-rw-r--r--searchcore/src/tests/proton/documentdb/feedview/feedview_test.cpp37
-rw-r--r--searchcore/src/vespa/searchcore/proton/attribute/attribute_writer.cpp13
-rw-r--r--searchcore/src/vespa/searchcore/proton/attribute/ifieldupdatecallback.h7
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/match_loop_communicator.h2
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/match_master.cpp2
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/match_tools.cpp18
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/match_tools.h98
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/searchable_feed_view.cpp2
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/storeonlyfeedview.cpp104
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/storeonlyfeedview.h24
-rw-r--r--searchcore/src/vespa/searchcore/proton/test/dummy_document_store.h2
-rw-r--r--searchcore/src/vespa/searchcore/proton/test/dummy_summary_manager.h2
-rw-r--r--searchlib/src/tests/index/docbuilder/docbuilder_test.cpp41
-rw-r--r--searchlib/src/vespa/searchlib/index/uri_field.cpp29
-rw-r--r--searchlib/src/vespa/searchlib/index/uri_field.h1
-rw-r--r--searchsummary/src/vespa/searchsummary/docsummary/dynamicteaserdfw.cpp59
-rw-r--r--vespalog/CMakeLists.txt1
23 files changed, 270 insertions, 231 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4fbc756236d..8972fada5bf 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -51,15 +51,21 @@ add_subdirectory(ann_benchmark)
add_subdirectory(application-model)
add_subdirectory(application-preprocessor)
add_subdirectory(athenz-identity-provider-service)
+add_subdirectory(client)
+add_subdirectory(cloud-tenant-cd)
+add_subdirectory(clustercontroller-apps)
+add_subdirectory(clustercontroller-core)
+add_subdirectory(clustercontroller-reindexer)
+add_subdirectory(clustercontroller-utils)
+add_subdirectory(config)
add_subdirectory(config-bundle)
+add_subdirectory(configd)
+add_subdirectory(configdefinitions)
add_subdirectory(config-model)
add_subdirectory(config-model-api)
+add_subdirectory(config-model-fat)
add_subdirectory(config-provisioning)
add_subdirectory(config-proxy)
-add_subdirectory(config)
-add_subdirectory(config-model-fat)
-add_subdirectory(configd)
-add_subdirectory(configdefinitions)
add_subdirectory(configserver)
add_subdirectory(configserver-flags)
add_subdirectory(configutil)
@@ -68,14 +74,9 @@ add_subdirectory(container-core)
add_subdirectory(container-disc)
add_subdirectory(container-messagebus)
add_subdirectory(container-search)
-add_subdirectory(container-search-gui)
add_subdirectory(container-search-and-docproc)
+add_subdirectory(container-search-gui)
add_subdirectory(container-spifly)
-add_subdirectory(cloud-tenant-cd)
-add_subdirectory(clustercontroller-apps)
-add_subdirectory(clustercontroller-core)
-add_subdirectory(clustercontroller-reindexer)
-add_subdirectory(clustercontroller-utils)
add_subdirectory(defaults)
add_subdirectory(docproc)
add_subdirectory(docprocs)
@@ -98,8 +99,8 @@ add_subdirectory(jrt_test)
add_subdirectory(linguistics)
add_subdirectory(linguistics-components)
add_subdirectory(logd)
-add_subdirectory(logserver)
add_subdirectory(logforwarder)
+add_subdirectory(logserver)
add_subdirectory(lowercasing_test)
add_subdirectory(messagebus)
add_subdirectory(messagebus_test)
@@ -127,22 +128,22 @@ add_subdirectory(tenant-cd-api)
add_subdirectory(vbench)
add_subdirectory(vdslib)
add_subdirectory(vdstestlib)
-add_subdirectory(vespa-athenz)
-add_subdirectory(vespa-feed-client)
-add_subdirectory(vespa-feed-client-cli)
-add_subdirectory(vespa-osgi-testrunner)
-add_subdirectory(vespa-testrunner-components)
-add_subdirectory(vespa_feed_perf)
add_subdirectory(vespa-3party-bundles)
+add_subdirectory(vespa-athenz)
add_subdirectory(vespabase)
add_subdirectory(vespaclient)
-add_subdirectory(vespaclient-core)
add_subdirectory(vespaclient-container-plugin)
+add_subdirectory(vespaclient-core)
add_subdirectory(vespaclient-java)
+add_subdirectory(vespa-feed-client)
+add_subdirectory(vespa-feed-client-cli)
+add_subdirectory(vespa_feed_perf)
add_subdirectory(vespajlib)
add_subdirectory(vespalib)
add_subdirectory(vespalog)
add_subdirectory(vespamalloc)
+add_subdirectory(vespa-osgi-testrunner)
+add_subdirectory(vespa-testrunner-components)
add_subdirectory(zkfacade)
add_subdirectory(zookeeper-command-line-client)
add_subdirectory(zookeeper-server)
diff --git a/ann_benchmark/src/vespa/ann_benchmark/vespa_ann_benchmark.cpp b/ann_benchmark/src/vespa/ann_benchmark/vespa_ann_benchmark.cpp
index 4af30a5d9d3..f9a4d5b43cc 100644
--- a/ann_benchmark/src/vespa/ann_benchmark/vespa_ann_benchmark.cpp
+++ b/ann_benchmark/src/vespa/ann_benchmark/vespa_ann_benchmark.cpp
@@ -10,7 +10,7 @@
#include <vespa/searchcommon/attribute/config.h>
#include <vespa/eval/eval/value.h>
#include <vespa/vespalib/test/insertion_operators.h>
-#include <ostream>
+#include <iostream>
#include <sstream>
#include <limits>
diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt
new file mode 100644
index 00000000000..1ca6d2b4e60
--- /dev/null
+++ b/client/CMakeLists.txt
@@ -0,0 +1,14 @@
+# Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+
+set(GODIR ${CMAKE_CURRENT_SOURCE_DIR}/go)
+
+file(GLOB_RECURSE GOSRCFILES ${GODIR}/*.go)
+
+add_custom_command(OUTPUT ${GODIR}/bin/vespa-logfmt
+ COMMAND make
+ DEPENDS ${GODIR}/Makefile ${GOSRCFILES}
+ WORKING_DIRECTORY ${GODIR})
+
+add_custom_target(vespalog_logfmt ALL DEPENDS ${GODIR}/bin/vespa-logfmt)
+
+install(PROGRAMS ${GODIR}/bin/vespa-logfmt DESTINATION bin)
diff --git a/client/go/.gitignore b/client/go/.gitignore
index 8933bc220cb..baab7c638c6 100644
--- a/client/go/.gitignore
+++ b/client/go/.gitignore
@@ -6,3 +6,4 @@ share/
!target/
mytestapp/
mytestapp-cache/
+mytmp/
diff --git a/client/go/Makefile b/client/go/Makefile
index 78adf299f0e..8a07f880c24 100644
--- a/client/go/Makefile
+++ b/client/go/Makefile
@@ -131,7 +131,8 @@ clean:
rmdir -p $(BIN) $(SHARE)/man/man1 > /dev/null 2>&1 || true
test: ci
- go test ./...
+ mkdir -p mytmp
+ TMPDIR=`pwd`/mytmp go test ./...
checkfmt:
@bash -c "diff --line-format='%L' <(echo -n) <(gofmt -l .)" || { echo "one or more files need to be formatted: try make fmt to fix this automatically"; exit 1; }
diff --git a/document/src/vespa/document/datatype/datatype.cpp b/document/src/vespa/document/datatype/datatype.cpp
index 3cc7034e336..7d53679bc28 100644
--- a/document/src/vespa/document/datatype/datatype.cpp
+++ b/document/src/vespa/document/datatype/datatype.cpp
@@ -155,7 +155,7 @@ DataType::buildFieldPath(FieldPath & path, vespalib::stringref remainFieldName)
{
if ( !remainFieldName.empty() ) {
path.reserve(4); // Optimize for short paths
- onBuildFieldPath(path,remainFieldName);
+ onBuildFieldPath(path, remainFieldName);
}
}
diff --git a/searchcore/src/tests/proton/documentdb/feedview/feedview_test.cpp b/searchcore/src/tests/proton/documentdb/feedview/feedview_test.cpp
index b326db47b5c..9d9bb64e6b1 100644
--- a/searchcore/src/tests/proton/documentdb/feedview/feedview_test.cpp
+++ b/searchcore/src/tests/proton/documentdb/feedview/feedview_test.cpp
@@ -143,7 +143,7 @@ struct MyIndexWriter : public test::MockIndexWriter
uint32_t _wantedLidLimit;
MyTracer &_tracer;
MyIndexWriter(MyTracer &tracer)
- : test::MockIndexWriter(IIndexManager::SP(new test::MockIndexManager())),
+ : test::MockIndexWriter(std::make_shared<test::MockIndexManager>()),
_removes(),
_heartBeatCount(0),
_commitCount(0),
@@ -224,7 +224,7 @@ struct MyDocumentStore : public test::DummyDocumentStore
DocMap _docs;
uint64_t _lastSyncToken;
uint32_t _compactLidSpaceLidLimit;
- MyDocumentStore(const document::DocumentTypeRepo & repo)
+ MyDocumentStore(const document::DocumentTypeRepo & repo) noexcept
: test::DummyDocumentStore("."),
_repo(repo),
_docs(),
@@ -266,42 +266,47 @@ MyDocumentStore::~MyDocumentStore() = default;
struct MySummaryManager : public test::DummySummaryManager
{
MyDocumentStore _store;
- MySummaryManager(const document::DocumentTypeRepo & repo) : _store(repo) {}
- virtual search::IDocumentStore &getBackingStore() override { return _store; }
+ MySummaryManager(const document::DocumentTypeRepo & repo) noexcept : _store(repo) {}
+ ~MySummaryManager() override;
+ search::IDocumentStore &getBackingStore() override { return _store; }
};
+MySummaryManager::~MySummaryManager() = default;
+
struct MySummaryAdapter : public test::MockSummaryAdapter
{
ISummaryManager::SP _sumMgr;
MyDocumentStore &_store;
MyLidVector _removes;
- MySummaryAdapter(const document::DocumentTypeRepo & repo)
- : _sumMgr(new MySummaryManager(repo)),
+ MySummaryAdapter(const document::DocumentTypeRepo & repo) noexcept
+ : _sumMgr(std::make_shared<MySummaryManager>(repo)),
_store(static_cast<MyDocumentStore &>(_sumMgr->getBackingStore())),
_removes()
{}
- virtual void put(SerialNum serialNum, DocumentIdT lid, const Document &doc) override {
+ ~MySummaryAdapter() override;
+ void put(SerialNum serialNum, DocumentIdT lid, const Document &doc) override {
_store.write(serialNum, lid, doc);
}
- virtual void put(SerialNum serialNum, DocumentIdT lid, const vespalib::nbostream & os) override {
+ void put(SerialNum serialNum, DocumentIdT lid, const vespalib::nbostream & os) override {
_store.write(serialNum, lid, os);
}
- virtual void remove(SerialNum serialNum, const DocumentIdT lid) override {
+ void remove(SerialNum serialNum, const DocumentIdT lid) override {
LOG(info, "MySummaryAdapter::remove(): serialNum(%" PRIu64 "), docId(%u)", serialNum, lid);
_store.remove(serialNum, lid);
_removes.push_back(lid);
}
- virtual const search::IDocumentStore &getDocumentStore() const override {
+ const search::IDocumentStore &getDocumentStore() const override {
return _store;
}
- virtual std::unique_ptr<Document> get(const DocumentIdT lid, const DocumentTypeRepo &repo) override {
+ std::unique_ptr<Document> get(const DocumentIdT lid, const DocumentTypeRepo &repo) override {
return _store.read(lid, repo);
}
- virtual void compactLidSpace(uint32_t wantedDocIdLimit) override {
+ void compactLidSpace(uint32_t wantedDocIdLimit) override {
_store.compactLidSpace(wantedDocIdLimit);
}
};
+MySummaryAdapter::~MySummaryAdapter() = default;
struct MyAttributeWriter : public IAttributeWriter
{
@@ -362,7 +367,7 @@ struct MyAttributeWriter : public IAttributeWriter
_updateLid = lid;
for (const auto & fieldUpdate : upd.getUpdates()) {
search::AttributeVector * attr = getWritableAttribute(fieldUpdate.getField().getName());
- onUpdate.onUpdateField(fieldUpdate.getField().getName(), attr);
+ onUpdate.onUpdateField(fieldUpdate.getField(), attr);
}
}
void update(SerialNum serialNum, const document::Document &doc, DocumentIdT lid, OnWriteDoneType) override {
@@ -434,7 +439,7 @@ struct SchemaContext
};
SchemaContext::SchemaContext() :
- _schema(new Schema()),
+ _schema(std::make_shared<Schema>()),
_builder()
{
_schema->addIndexField(Schema::IndexField("i1", DataType::STRING, CollectionType::SINGLE));
@@ -442,7 +447,7 @@ SchemaContext::SchemaContext() :
_schema->addAttributeField(Schema::AttributeField("a2", DataType::BOOLEANTREE, CollectionType::SINGLE));
_schema->addAttributeField(Schema::AttributeField("a3", DataType::TENSOR, CollectionType::SINGLE));
_schema->addSummaryField(Schema::SummaryField("s1", DataType::STRING, CollectionType::SINGLE));
- _builder.reset(new DocBuilder(*_schema));
+ _builder = std::make_unique<DocBuilder>(*_schema);
}
SchemaContext::~SchemaContext() = default;
@@ -464,7 +469,7 @@ struct DocumentContext
DocumentContext::DocumentContext(const vespalib::string &docId, uint64_t timestamp, DocBuilder &builder)
: doc(builder.startDocument(docId).startSummaryField("s1").addStr(docId).endField().endDocument().release()),
- upd(new DocumentUpdate(*builder.getDocumentTypeRepo(), builder.getDocumentType(), doc->getId())),
+ upd(std::make_shared<DocumentUpdate>(*builder.getDocumentTypeRepo(), builder.getDocumentType(), doc->getId())),
bid(BucketFactory::getNumBucketBits(), doc->getId().getGlobalId().convertToBucketId().getRawId()),
ts(timestamp)
{}
diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attribute_writer.cpp b/searchcore/src/vespa/searchcore/proton/attribute/attribute_writer.cpp
index bb25b3da7be..021fc4717af 100644
--- a/searchcore/src/vespa/searchcore/proton/attribute/attribute_writer.cpp
+++ b/searchcore/src/vespa/searchcore/proton/attribute/attribute_writer.cpp
@@ -764,9 +764,9 @@ AttributeWriter::update(SerialNum serialNum, const DocumentUpdate &upd, Document
for (const auto &fupd : upd.getUpdates()) {
LOG(debug, "Retrieving guard for attribute vector '%s'.", fupd.getField().getName().data());
- auto itr = _attrMap.find(fupd.getField().getName());
- AttributeVector * attrp = (itr != _attrMap.end()) ? itr->second.attribute : nullptr;
- onUpdate.onUpdateField(fupd.getField().getName(), attrp);
+ auto found = _attrMap.find(fupd.getField().getName());
+ AttributeVector * attrp = (found != _attrMap.end()) ? found->second.attribute : nullptr;
+ onUpdate.onUpdateField(fupd.getField(), attrp);
if (__builtin_expect(attrp == nullptr, false)) {
LOG(spam, "Failed to find attribute vector %s", fupd.getField().getName().data());
continue;
@@ -776,16 +776,15 @@ AttributeWriter::update(SerialNum serialNum, const DocumentUpdate &upd, Document
if (__builtin_expect(attrp->getStatus().getLastSyncToken() >= serialNum, false)) {
continue;
}
- if (itr->second.use_two_phase_put_for_assign_updates &&
- is_single_assign_update(fupd)) {
+ if (found->second.use_two_phase_put_for_assign_updates && is_single_assign_update(fupd)) {
auto prepare_task = std::make_unique<PreparePutTask>(serialNum, lid, *attrp, get_single_assign_update_field_value(fupd));
auto complete_task = std::make_unique<CompletePutTask>(*prepare_task, onWriteDone);
LOG(debug, "About to handle assign update as two phase put for docid %u in attribute vector '%s'",
lid, attrp->getName().c_str());
_shared_executor.execute(CpuUsage::wrap(std::move(prepare_task), CpuUsage::Category::WRITE));
- _attributeFieldWriter.executeTask(itr->second.executor_id, std::move(complete_task));
+ _attributeFieldWriter.executeTask(found->second.executor_id, std::move(complete_task));
} else {
- args[itr->second.executor_id.getId()]->_updates.emplace_back(attrp, &fupd);
+ args[found->second.executor_id.getId()]->_updates.emplace_back(attrp, &fupd);
LOG(debug, "About to apply update for docId %u in attribute vector '%s'.", lid, attrp->getName().c_str());
}
}
diff --git a/searchcore/src/vespa/searchcore/proton/attribute/ifieldupdatecallback.h b/searchcore/src/vespa/searchcore/proton/attribute/ifieldupdatecallback.h
index d8872607b44..d3ab970fb39 100644
--- a/searchcore/src/vespa/searchcore/proton/attribute/ifieldupdatecallback.h
+++ b/searchcore/src/vespa/searchcore/proton/attribute/ifieldupdatecallback.h
@@ -5,16 +5,17 @@
#include <vespa/vespalib/stllike/string.h>
namespace search { class AttributeVector; }
+namespace document { class Field; }
namespace proton {
struct IFieldUpdateCallback {
- virtual ~IFieldUpdateCallback() { }
- virtual void onUpdateField(vespalib::stringref fieldName, const search::AttributeVector * attr) = 0;
+ virtual ~IFieldUpdateCallback() = default;
+ virtual void onUpdateField(const document::Field & field, const search::AttributeVector * attr) = 0;
};
struct DummyFieldUpdateCallback : IFieldUpdateCallback {
- void onUpdateField(vespalib::stringref, const search::AttributeVector *) override {}
+ void onUpdateField(const document::Field & , const search::AttributeVector *) override {}
};
}
diff --git a/searchcore/src/vespa/searchcore/proton/matching/match_loop_communicator.h b/searchcore/src/vespa/searchcore/proton/matching/match_loop_communicator.h
index 217fa2db1f5..3f50bf9faec 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/match_loop_communicator.h
+++ b/searchcore/src/vespa/searchcore/proton/matching/match_loop_communicator.h
@@ -8,7 +8,7 @@
namespace proton::matching {
-class MatchLoopCommunicator : public IMatchLoopCommunicator
+class MatchLoopCommunicator final : public IMatchLoopCommunicator
{
private:
using IDiversifier = search::queryeval::IDiversifier;
diff --git a/searchcore/src/vespa/searchcore/proton/matching/match_master.cpp b/searchcore/src/vespa/searchcore/proton/matching/match_master.cpp
index 985176bcef5..84ff0672fa0 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/match_master.cpp
+++ b/searchcore/src/vespa/searchcore/proton/matching/match_master.cpp
@@ -24,7 +24,7 @@ using vespalib::Issue;
namespace {
-struct TimedMatchLoopCommunicator : IMatchLoopCommunicator {
+struct TimedMatchLoopCommunicator final : IMatchLoopCommunicator {
IMatchLoopCommunicator &communicator;
vespalib::Timer timer;
vespalib::duration elapsed;
diff --git a/searchcore/src/vespa/searchcore/proton/matching/match_tools.cpp b/searchcore/src/vespa/searchcore/proton/matching/match_tools.cpp
index e0449236af0..eecbf116e9d 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/match_tools.cpp
+++ b/searchcore/src/vespa/searchcore/proton/matching/match_tools.cpp
@@ -14,15 +14,12 @@
#include <vespa/vespalib/data/slime/inserter.h>
#include <vespa/vespalib/util/issue.h>
-using search::attribute::IAttributeContext;
-using search::queryeval::IRequestContext;
using search::queryeval::IDiversifier;
using search::attribute::diversity::DiversityFilter;
using search::attribute::BasicType;
using search::attribute::AttributeBlueprintParams;
using vespalib::Issue;
-using namespace search::fef;
using namespace search::fef::indexproperties::matchphase;
using namespace search::fef::indexproperties::matching;
using namespace search::fef::indexproperties;
@@ -33,6 +30,9 @@ namespace proton::matching {
namespace {
+using search::fef::Properties;
+using search::fef::RankSetup;
+
bool contains_all(const HandleRecorder::HandleMap &old_map,
const HandleRecorder::HandleMap &new_map)
{
@@ -70,7 +70,7 @@ extractDiversityParams(const RankSetup &rankSetup, const Properties &rankPropert
} // namespace proton::matching::<unnamed>
void
-MatchTools::setup(search::fef::RankProgram::UP rank_program, double termwise_limit)
+MatchTools::setup(std::unique_ptr<RankProgram> rank_program, double termwise_limit)
{
if (_search) {
_match_data->soft_reset();
@@ -240,12 +240,12 @@ std::unique_ptr<IDiversifier>
MatchToolsFactory::createDiversifier(uint32_t heapSize) const
{
if ( !_diversityParams.enabled() ) {
- return std::unique_ptr<IDiversifier>();
+ return {};
}
auto attr = _requestContext.getAttribute(_diversityParams.attribute);
if ( !attr) {
Issue::report("Skipping diversity due to no %s attribute.", _diversityParams.attribute.c_str());
- return std::unique_ptr<IDiversifier>();
+ return {};
}
size_t max_per_group = heapSize/_diversityParams.min_groups;
return DiversityFilter::create(*attr, heapSize, max_per_group, _diversityParams.min_groups,
@@ -302,10 +302,8 @@ MatchToolsFactory::get_feature_rename_map() const
}
AttributeBlueprintParams
-MatchToolsFactory::extract_global_filter_params(const search::fef::RankSetup& rank_setup,
- const search::fef::Properties& rank_properties,
- uint32_t active_docids,
- uint32_t docid_limit)
+MatchToolsFactory::extract_global_filter_params(const RankSetup& rank_setup, const Properties& rank_properties,
+ uint32_t active_docids, uint32_t docid_limit)
{
double lower_limit = GlobalFilterLowerLimit::lookup(rank_properties, rank_setup.get_global_filter_lower_limit());
double upper_limit = GlobalFilterUpperLimit::lookup(rank_properties, rank_setup.get_global_filter_upper_limit());
diff --git a/searchcore/src/vespa/searchcore/proton/matching/match_tools.h b/searchcore/src/vespa/searchcore/proton/matching/match_tools.h
index 11e943957ef..d7254d4b958 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/match_tools.h
+++ b/searchcore/src/vespa/searchcore/proton/matching/match_tools.h
@@ -30,19 +30,25 @@ class MatchTools
{
private:
using IRequestContext = search::queryeval::IRequestContext;
- QueryLimiter &_queryLimiter;
- const vespalib::Doom &_doom;
- const Query &_query;
- MaybeMatchPhaseLimiter &_match_limiter;
- const QueryEnvironment &_queryEnv;
- const search::fef::RankSetup &_rankSetup;
- const search::fef::Properties &_featureOverrides;
- std::unique_ptr<search::fef::MatchData> _match_data;
- std::unique_ptr<search::fef::RankProgram> _rank_program;
- search::queryeval::SearchIterator::UP _search;
- HandleRecorder::HandleMap _used_handles;
- bool _search_has_changed;
- void setup(std::unique_ptr<search::fef::RankProgram>, double termwise_limit = 1.0);
+ using SearchIterator = search::queryeval::SearchIterator;
+ using MatchData = search::fef::MatchData;
+ using MatchDataLayout = search::fef::MatchDataLayout;
+ using Properties = search::fef::Properties;
+ using RankProgram = search::fef::RankProgram;
+ using RankSetup = search::fef::RankSetup;
+ QueryLimiter &_queryLimiter;
+ const vespalib::Doom &_doom;
+ const Query &_query;
+ MaybeMatchPhaseLimiter &_match_limiter;
+ const QueryEnvironment &_queryEnv;
+ const RankSetup &_rankSetup;
+ const Properties &_featureOverrides;
+ std::unique_ptr<MatchData> _match_data;
+ std::unique_ptr<RankProgram> _rank_program;
+ std::unique_ptr<SearchIterator> _search;
+ HandleRecorder::HandleMap _used_handles;
+ bool _search_has_changed;
+ void setup(std::unique_ptr<RankProgram>, double termwise_limit = 1.0);
public:
typedef std::unique_ptr<MatchTools> UP;
MatchTools(const MatchTools &) = delete;
@@ -52,19 +58,19 @@ public:
const Query &query,
MaybeMatchPhaseLimiter &match_limiter_in,
const QueryEnvironment &queryEnv,
- const search::fef::MatchDataLayout &mdl,
- const search::fef::RankSetup &rankSetup,
- const search::fef::Properties &featureOverrides);
+ const MatchDataLayout &mdl,
+ const RankSetup &rankSetup,
+ const Properties &featureOverrides);
~MatchTools();
const vespalib::Doom &getDoom() const { return _doom; }
QueryLimiter & getQueryLimiter() { return _queryLimiter; }
MaybeMatchPhaseLimiter &match_limiter() { return _match_limiter; }
bool has_second_phase_rank() const;
- const search::fef::MatchData &match_data() const { return *_match_data; }
- search::fef::RankProgram &rank_program() { return *_rank_program; }
- search::queryeval::SearchIterator &search() { return *_search; }
- search::queryeval::SearchIterator::UP borrow_search() { return std::move(_search); }
- void give_back_search(search::queryeval::SearchIterator::UP search_in) { _search = std::move(search_in); }
+ const MatchData &match_data() const { return *_match_data; }
+ RankProgram &rank_program() { return *_rank_program; }
+ SearchIterator &search() { return *_search; }
+ std::unique_ptr<SearchIterator> borrow_search() { return std::move(_search); }
+ void give_back_search(std::unique_ptr<SearchIterator> search_in) { _search = std::move(search_in); }
void tag_search_as_changed() { _search_has_changed = true; }
void setup_first_phase();
void setup_second_phase();
@@ -92,17 +98,25 @@ class MatchToolsFactory
{
private:
using IAttributeFunctor = search::attribute::IAttributeFunctor;
- QueryLimiter & _queryLimiter;
- search::attribute::AttributeBlueprintParams _global_filter_params;
- Query _query;
- MaybeMatchPhaseLimiter::UP _match_limiter;
- QueryEnvironment _queryEnv;
- RequestContext _requestContext;
- search::fef::MatchDataLayout _mdl;
- const search::fef::RankSetup & _rankSetup;
- const search::fef::Properties & _featureOverrides;
- DiversityParams _diversityParams;
- bool _valid;
+ using IAttributeContext = search::attribute::IAttributeContext;
+ using AttributeBlueprintParams = search::attribute::AttributeBlueprintParams;
+ using MatchDataLayout = search::fef::MatchDataLayout;
+ using Properties = search::fef::Properties;
+ using RankProgram = search::fef::RankProgram;
+ using RankSetup = search::fef::RankSetup;
+ using IIndexEnvironment = search::fef::IIndexEnvironment;
+ using IDiversifier = search::queryeval::IDiversifier;
+ QueryLimiter & _queryLimiter;
+ AttributeBlueprintParams _global_filter_params;
+ Query _query;
+ MaybeMatchPhaseLimiter::UP _match_limiter;
+ QueryEnvironment _queryEnv;
+ RequestContext _requestContext;
+ MatchDataLayout _mdl;
+ const RankSetup & _rankSetup;
+ const Properties & _featureOverrides;
+ DiversityParams _diversityParams;
+ bool _valid;
std::unique_ptr<AttributeOperationTask>
createTask(vespalib::stringref attribute, vespalib::stringref operation) const;
@@ -114,23 +128,23 @@ public:
MatchToolsFactory(QueryLimiter & queryLimiter,
const vespalib::Doom & softDoom,
ISearchContext &searchContext,
- search::attribute::IAttributeContext &attributeContext,
+ IAttributeContext &attributeContext,
search::engine::Trace & root_trace,
vespalib::stringref queryStack,
const vespalib::string &location,
const ViewResolver &viewResolver,
const search::IDocumentMetaStore &metaStore,
- const search::fef::IIndexEnvironment &indexEnv,
- const search::fef::RankSetup &rankSetup,
- const search::fef::Properties &rankProperties,
- const search::fef::Properties &featureOverrides,
+ const IIndexEnvironment &indexEnv,
+ const RankSetup &rankSetup,
+ const Properties &rankProperties,
+ const Properties &featureOverrides,
bool is_search);
~MatchToolsFactory();
bool valid() const { return _valid; }
const MaybeMatchPhaseLimiter &match_limiter() const { return *_match_limiter; }
MatchTools::UP createMatchTools() const;
bool should_diversify() const { return _diversityParams.enabled(); }
- std::unique_ptr<search::queryeval::IDiversifier> createDiversifier(uint32_t heapSize) const;
+ std::unique_ptr<IDiversifier> createDiversifier(uint32_t heapSize) const;
search::queryeval::Blueprint::HitEstimate estimate() const { return _query.estimate(); }
bool has_first_phase_rank() const;
bool has_match_features() const;
@@ -151,11 +165,9 @@ public:
* When searchable-copies > 1, we must scale the parameters to match the effective range of the estimated hit ratio.
* This is done by multiplying with the active hit ratio (active docids / docid limit).
*/
- static search::attribute::AttributeBlueprintParams
- extract_global_filter_params(const search::fef::RankSetup& rank_setup,
- const search::fef::Properties& rank_properties,
- uint32_t active_docids,
- uint32_t docid_limit);
+ static AttributeBlueprintParams
+ extract_global_filter_params(const RankSetup& rank_setup, const Properties& rank_properties,
+ uint32_t active_docids, uint32_t docid_limit);
};
}
diff --git a/searchcore/src/vespa/searchcore/proton/server/searchable_feed_view.cpp b/searchcore/src/vespa/searchcore/proton/server/searchable_feed_view.cpp
index 207f1d813d8..7a78b4ba82a 100644
--- a/searchcore/src/vespa/searchcore/proton/server/searchable_feed_view.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/searchable_feed_view.cpp
@@ -34,7 +34,7 @@ SearchableFeedView::SearchableFeedView(StoreOnlyFeedView::Context storeOnlyCtx,
const FastAccessFeedView::Context &fastUpdateCtx, Context ctx)
: Parent(std::move(storeOnlyCtx), params, fastUpdateCtx),
_indexWriter(ctx._indexWriter),
- _hasIndexedFields(_schema->getNumIndexFields() > 0)
+ _hasIndexedFields(getSchema()->getNumIndexFields() > 0)
{ }
SearchableFeedView::~SearchableFeedView() = default;
diff --git a/searchcore/src/vespa/searchcore/proton/server/storeonlyfeedview.cpp b/searchcore/src/vespa/searchcore/proton/server/storeonlyfeedview.cpp
index a537742b79b..a9850b5c2b7 100644
--- a/searchcore/src/vespa/searchcore/proton/server/storeonlyfeedview.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/storeonlyfeedview.cpp
@@ -7,14 +7,15 @@
#include "putdonecontext.h"
#include "removedonecontext.h"
#include "updatedonecontext.h"
-#include <vespa/document/datatype/documenttype.h>
-#include <vespa/document/fieldvalue/document.h>
-#include <vespa/document/repo/documenttyperepo.h>
#include <vespa/searchcore/proton/attribute/ifieldupdatecallback.h>
#include <vespa/searchcore/proton/common/feedtoken.h>
#include <vespa/searchcore/proton/feedoperation/operations.h>
#include <vespa/searchcore/proton/reference/i_gid_to_lid_change_handler.h>
#include <vespa/searchcore/proton/reference/i_pending_gid_to_lid_changes.h>
+#include <vespa/searchlib/index/uri_field.h>
+#include <vespa/document/repo/documenttyperepo.h>
+#include <vespa/document/datatype/documenttype.h>
+#include <vespa/document/fieldvalue/document.h>
#include <vespa/vespalib/util/cpu_usage.h>
#include <vespa/vespalib/util/destructor_callbacks.h>
#include <vespa/vespalib/util/exceptions.h>
@@ -38,7 +39,7 @@ using vespalib::CpuUsage;
using vespalib::IDestructorCallback;
using vespalib::IllegalStateException;
using vespalib::makeLambdaTask;
-using vespalib::make_string;
+using vespalib::make_string_short::fmt;
namespace proton {
@@ -88,8 +89,8 @@ SummaryPutDoneContext::SummaryPutDoneContext(FeedToken token, IPendingLidTracker
SummaryPutDoneContext::~SummaryPutDoneContext() = default;
-std::vector<document::GlobalId> getGidsToRemove(const IDocumentMetaStore &metaStore,
- const LidVectorContext::LidVector &lidsToRemove)
+std::vector<document::GlobalId>
+getGidsToRemove(const IDocumentMetaStore &metaStore, const LidVectorContext::LidVector &lidsToRemove)
{
std::vector<document::GlobalId> gids;
gids.reserve(lidsToRemove.size());
@@ -102,23 +103,24 @@ std::vector<document::GlobalId> getGidsToRemove(const IDocumentMetaStore &metaSt
return gids;
}
-void putMetaData(documentmetastore::IStore &meta_store, const DocumentId & doc_id,
- const DocumentOperation &op, bool is_removed_doc)
+void
+putMetaData(documentmetastore::IStore &meta_store, const DocumentId & doc_id,
+ const DocumentOperation &op, bool is_removed_doc)
{
documentmetastore::IStore::Result putRes(
meta_store.put(doc_id.getGlobalId(), op.getBucketId(), op.getTimestamp(),
op.getSerializedDocSize(), op.getLid(), op.get_prepare_serial_num()));
if (!putRes.ok()) {
- throw IllegalStateException(
- make_string("Could not put <lid, gid> pair for %sdocument with id '%s' and gid '%s'",
- is_removed_doc ? "removed " : "", doc_id.toString().c_str(),
- doc_id.getGlobalId().toString().c_str()));
+ throw IllegalStateException(fmt("Could not put <lid, gid> pair for %sdocument with id '%s' and gid '%s'",
+ is_removed_doc ? "removed " : "", doc_id.toString().c_str(),
+ doc_id.getGlobalId().toString().c_str()));
}
assert(op.getLid() == putRes._lid);
}
-void removeMetaData(documentmetastore::IStore &meta_store, const GlobalId & gid, const DocumentId &doc_id,
- const DocumentOperation &op, bool is_removed_doc)
+void
+removeMetaData(documentmetastore::IStore &meta_store, const GlobalId & gid, const DocumentId &doc_id,
+ const DocumentOperation &op, bool is_removed_doc)
{
assert(meta_store.validLid(op.getPrevLid()));
assert(is_removed_doc == op.getPrevMarkedAsRemoved());
@@ -127,9 +129,8 @@ void removeMetaData(documentmetastore::IStore &meta_store, const GlobalId & gid,
(void) meta;
if (!meta_store.remove(op.getPrevLid(), op.get_prepare_serial_num())) {
throw IllegalStateException(
- make_string("Could not remove <lid, gid> pair for %sdocument with id '%s' and gid '%s'",
- is_removed_doc ? "removed " : "", doc_id.toString().c_str(),
- gid.toString().c_str()));
+ fmt("Could not remove <lid, gid> pair for %sdocument with id '%s' and gid '%s'",
+ is_removed_doc ? "removed " : "", doc_id.toString().c_str(), gid.toString().c_str()));
}
}
@@ -147,6 +148,37 @@ moveMetaData(documentmetastore::IStore &meta_store, const DocumentId & doc_id, c
meta_store.move(op.getPrevLid(), op.getLid(), op.get_prepare_serial_num());
}
+class UpdateScope final : public IFieldUpdateCallback
+{
+private:
+ const vespalib::hash_set<int32_t> & _indexedFields;
+ bool _nonAttributeFields;
+public:
+ bool _hasIndexedFields;
+
+ UpdateScope(const vespalib::hash_set<int32_t> & indexedFields, const DocumentUpdate & upd);
+ bool hasIndexOrNonAttributeFields() const {
+ return _hasIndexedFields || _nonAttributeFields;
+ }
+ void onUpdateField(const document::Field & field, const search::AttributeVector * attr) override;
+};
+
+UpdateScope::UpdateScope(const vespalib::hash_set<int32_t> & indexedFields, const DocumentUpdate & upd)
+ : _indexedFields(indexedFields),
+ _nonAttributeFields(!upd.getFieldPathUpdates().empty()),
+ _hasIndexedFields(false)
+{}
+
+void
+UpdateScope::onUpdateField(const document::Field & field, const search::AttributeVector * attr) {
+ if (!_nonAttributeFields && (attr == nullptr || !attr->isUpdateableInMemoryOnly())) {
+ _nonAttributeFields = true;
+ }
+ if (!_hasIndexedFields && (_indexedFields.find(field.getId()) != _indexedFields.end())) {
+ _hasIndexedFields = true;
+ }
+}
+
} // namespace
StoreOnlyFeedView::StoreOnlyFeedView(Context ctx, const PersistentParams &params)
@@ -160,12 +192,26 @@ StoreOnlyFeedView::StoreOnlyFeedView(Context ctx, const PersistentParams &params
_pendingLidsForDocStore(),
_pendingLidsForCommit(std::move(ctx._pendingLidsForCommit)),
_schema(std::move(ctx._schema)),
+ _indexedFields(),
_writeService(ctx._writeService),
_params(params),
_metaStore(_documentMetaStoreContext->get()),
_gidToLidChangeHandler(ctx._gidToLidChangeHandler)
{
_docType = _repo->getDocumentType(_params._docTypeName.getName());
+ if (_schema && _docType) {
+ for (const auto &indexField : _schema->getIndexFields()) {
+ size_t dotPos = indexField.getName().find('.');
+ if ((dotPos == vespalib::string::npos) || search::index::UriField::mightBePartofUri(indexField.getName())) {
+ document::FieldPath fieldPath;
+ _docType->buildFieldPath(fieldPath, indexField.getName().substr(0, dotPos));
+ _indexedFields.insert(fieldPath.back().getFieldRef().getId());
+ } else {
+ throw IllegalStateException("Field '%s' is not a valid index name", indexField.getName().c_str());
+ }
+
+ }
+ }
}
StoreOnlyFeedView::~StoreOnlyFeedView() = default;
@@ -207,7 +253,7 @@ void
StoreOnlyFeedView::putAttributes(SerialNum, Lid, const Document &, OnPutDoneType) {}
void
-StoreOnlyFeedView::putIndexedFields(SerialNum, Lid, const Document::SP &, OnOperationDoneType) {}
+StoreOnlyFeedView::putIndexedFields(SerialNum, Lid, const std::shared_ptr<Document> &, OnOperationDoneType) {}
void
StoreOnlyFeedView::preparePut(PutOperation &putOp)
@@ -285,7 +331,7 @@ StoreOnlyFeedView::updateAttributes(SerialNum, Lid, const DocumentUpdate & upd,
OnOperationDoneType, IFieldUpdateCallback & onUpdate)
{
for (const auto & fieldUpdate : upd.getUpdates()) {
- onUpdate.onUpdateField(fieldUpdate.getField().getName(), nullptr);
+ onUpdate.onUpdateField(fieldUpdate.getField(), nullptr);
}
}
@@ -387,22 +433,6 @@ StoreOnlyFeedView::heartBeatSummary(SerialNum serialNum, DoneCallback onDone) {
}));
}
-StoreOnlyFeedView::UpdateScope::UpdateScope(const search::index::Schema & schema, const DocumentUpdate & upd)
- : _schema(&schema),
- _indexedFields(false),
- _nonAttributeFields(!upd.getFieldPathUpdates().empty())
-{}
-
-void
-StoreOnlyFeedView::UpdateScope::onUpdateField(vespalib::stringref fieldName, const search::AttributeVector * attr) {
- if (!_nonAttributeFields && (attr == nullptr || !attr->isUpdateableInMemoryOnly())) {
- _nonAttributeFields = true;
- }
- if (!_indexedFields && _schema->isIndexField(fieldName)) {
- _indexedFields = true;
- }
-}
-
void
StoreOnlyFeedView::internalUpdate(FeedToken token, const UpdateOperation &updOp) {
if ( ! updOp.getUpdate()) {
@@ -432,7 +462,7 @@ StoreOnlyFeedView::internalUpdate(FeedToken token, const UpdateOperation &updOp)
}
auto onWriteDone = createUpdateDoneContext(std::move(token), get_pending_lid_token(updOp), updOp.getUpdate());
- UpdateScope updateScope(*_schema, upd);
+ UpdateScope updateScope(_indexedFields, upd);
updateAttributes(serialNum, lid, upd, onWriteDone, updateScope);
if (updateScope.hasIndexOrNonAttributeFields()) {
@@ -440,7 +470,7 @@ StoreOnlyFeedView::internalUpdate(FeedToken token, const UpdateOperation &updOp)
FutureDoc futureDoc = promisedDoc.get_future().share();
onWriteDone->setDocument(futureDoc);
_pendingLidsForDocStore.waitComplete(lid);
- if (updateScope._indexedFields) {
+ if (updateScope._hasIndexedFields) {
updateIndexedFields(serialNum, lid, futureDoc, onWriteDone);
}
PromisedStream promisedStream;
diff --git a/searchcore/src/vespa/searchcore/proton/server/storeonlyfeedview.h b/searchcore/src/vespa/searchcore/proton/server/storeonlyfeedview.h
index 2822aa70525..25a98da7ce7 100644
--- a/searchcore/src/vespa/searchcore/proton/server/storeonlyfeedview.h
+++ b/searchcore/src/vespa/searchcore/proton/server/storeonlyfeedview.h
@@ -9,7 +9,6 @@
#include "searchcontext.h"
#include <vespa/searchcore/proton/common/pendinglidtracker.h>
#include <vespa/searchcore/proton/common/doctypename.h>
-#include <vespa/searchcore/proton/attribute/ifieldupdatecallback.h>
#include <vespa/searchcore/proton/common/feeddebugger.h>
#include <vespa/searchcore/proton/documentmetastore/documentmetastore.h>
#include <vespa/searchcore/proton/documentmetastore/documentmetastorecontext.h>
@@ -18,9 +17,10 @@
#include <vespa/searchcore/proton/persistenceengine/resulthandler.h>
#include <vespa/searchcorespi/index/ithreadingservice.h>
#include <vespa/searchlib/query/base.h>
+#include <vespa/searchcore/proton/feedoperation/operations.h>
#include <vespa/vespalib/util/threadstackexecutorbase.h>
+#include <vespa/vespalib/stllike/hash_set.h>
#include <future>
-#include <vespa/searchcore/proton/feedoperation/operations.h>
namespace vespalib { class IDestructorCallback; }
@@ -118,22 +118,6 @@ public:
{}
};
-protected:
- class UpdateScope : public IFieldUpdateCallback
- {
- private:
- const search::index::Schema *_schema;
- public:
- bool _indexedFields;
- bool _nonAttributeFields;
-
- UpdateScope(const search::index::Schema & schema, const DocumentUpdate & upd);
- bool hasIndexOrNonAttributeFields() const {
- return _indexedFields || _nonAttributeFields;
- }
- void onUpdateField(vespalib::stringref fieldName, const search::AttributeVector * attr) override;
- };
-
private:
const ISummaryAdapter::SP _summaryAdapter;
const IDocumentMetaStoreContext::SP _documentMetaStoreContext;
@@ -142,9 +126,9 @@ private:
LidReuseDelayer _lidReuseDelayer;
PendingLidTracker _pendingLidsForDocStore;
std::shared_ptr<PendingLidTrackerBase> _pendingLidsForCommit;
-
+ const search::index::Schema::SP _schema;
+ vespalib::hash_set<int32_t> _indexedFields;
protected:
- const search::index::Schema::SP _schema;
searchcorespi::index::IThreadingService &_writeService;
PersistentParams _params;
IDocumentMetaStore &_metaStore;
diff --git a/searchcore/src/vespa/searchcore/proton/test/dummy_document_store.h b/searchcore/src/vespa/searchcore/proton/test/dummy_document_store.h
index 9e0e8f66dc0..d8d6e119d9b 100644
--- a/searchcore/src/vespa/searchcore/proton/test/dummy_document_store.h
+++ b/searchcore/src/vespa/searchcore/proton/test/dummy_document_store.h
@@ -11,7 +11,7 @@ struct DummyDocumentStore : public search::IDocumentStore
vespalib::string _baseDir;
DummyDocumentStore() = default;
- DummyDocumentStore(const vespalib::string &baseDir)
+ DummyDocumentStore(const vespalib::string &baseDir) noexcept
: _baseDir(baseDir)
{}
~DummyDocumentStore() = default;
diff --git a/searchcore/src/vespa/searchcore/proton/test/dummy_summary_manager.h b/searchcore/src/vespa/searchcore/proton/test/dummy_summary_manager.h
index 4d3513c52f5..f826cbbe921 100644
--- a/searchcore/src/vespa/searchcore/proton/test/dummy_summary_manager.h
+++ b/searchcore/src/vespa/searchcore/proton/test/dummy_summary_manager.h
@@ -9,7 +9,7 @@ namespace test {
struct DummySummaryManager : public ISummaryManager
{
- virtual ISummarySetup::SP
+ ISummarySetup::SP
createSummarySetup(const vespa::config::search::SummaryConfig &,
const vespa::config::search::SummarymapConfig &,
const vespa::config::search::summary::JuniperrcConfig &,
diff --git a/searchlib/src/tests/index/docbuilder/docbuilder_test.cpp b/searchlib/src/tests/index/docbuilder/docbuilder_test.cpp
index 75cccb0d573..9f1027d0522 100644
--- a/searchlib/src/tests/index/docbuilder/docbuilder_test.cpp
+++ b/searchlib/src/tests/index/docbuilder/docbuilder_test.cpp
@@ -13,8 +13,7 @@ LOG_SETUP("docbuilder_test");
using namespace document;
using search::index::schema::CollectionType;
-namespace search {
-namespace index {
+namespace search::index {
namespace
{
@@ -26,15 +25,8 @@ namespace linguistics
const vespalib::string SPANTREE_NAME("linguistics");
}
-class Test : public vespalib::TestApp {
-private:
- void testBuilder();
-public:
- int Main() override;
-};
-void
-Test::testBuilder()
+TEST("test docBuilder")
{
Schema s;
s.addIndexField(Schema::IndexField("ia", schema::DataType::STRING));
@@ -415,7 +407,7 @@ Test::testBuilder()
EXPECT_EQUAL("</af>", *itr++);
EXPECT_EQUAL("</document>", *itr++);
EXPECT_TRUE(itr == lines.end());
-#if 1
+#if 0
std::cout << "onedoc xml start -----" << std::endl <<
xml << std::endl <<
"-------" << std::endl;
@@ -479,7 +471,7 @@ Test::testBuilder()
expSpans.push_back(Span(15, 9));
expSpans.push_back(Span(15, 9));
ASSERT_TRUE(expSpans == spans);
-#if 1
+#if 0
std::cout << "onedoc xml start -----" << std::endl <<
xml << std::endl <<
"-------" << std::endl;
@@ -490,18 +482,21 @@ Test::testBuilder()
}
}
-int
-Test::Main()
-{
- TEST_INIT("docbuilder_test");
-
- testBuilder();
-
- TEST_DONE();
+TEST("test if index names are valid uri parts") {
+ EXPECT_FALSE(UriField::mightBePartofUri("all"));
+ EXPECT_FALSE(UriField::mightBePartofUri("fragment"));
+ EXPECT_FALSE(UriField::mightBePartofUri(".all"));
+ EXPECT_FALSE(UriField::mightBePartofUri("all.b"));
+ EXPECT_TRUE(UriField::mightBePartofUri("b.all"));
+ EXPECT_TRUE(UriField::mightBePartofUri("b.scheme"));
+ EXPECT_TRUE(UriField::mightBePartofUri("b.host"));
+ EXPECT_TRUE(UriField::mightBePartofUri("b.port"));
+ EXPECT_TRUE(UriField::mightBePartofUri("b.hostname"));
+ EXPECT_TRUE(UriField::mightBePartofUri("b.path"));
+ EXPECT_TRUE(UriField::mightBePartofUri("b.query"));
+ EXPECT_TRUE(UriField::mightBePartofUri("b.fragment"));
}
}
-}
-
-TEST_APPHOOK(search::index::Test);
+TEST_MAIN() { TEST_RUN_ALL(); }
diff --git a/searchlib/src/vespa/searchlib/index/uri_field.cpp b/searchlib/src/vespa/searchlib/index/uri_field.cpp
index 380f67210d3..070afc94837 100644
--- a/searchlib/src/vespa/searchlib/index/uri_field.cpp
+++ b/searchlib/src/vespa/searchlib/index/uri_field.cpp
@@ -18,9 +18,7 @@ UriField::UriField()
}
bool
-UriField::valid(const Schema &schema,
- uint32_t fieldId,
- const Schema::CollectionType &collectionType)
+UriField::valid(const Schema &schema, uint32_t fieldId, const Schema::CollectionType &collectionType)
{
if (fieldId == Schema::UNKNOWN_FIELD_ID) {
return false;
@@ -36,9 +34,7 @@ UriField::valid(const Schema &schema,
}
bool
-UriField::broken(const Schema &schema,
- const Schema::CollectionType &
- collectionType) const
+UriField::broken(const Schema &schema, const Schema::CollectionType & collectionType) const
{
return !valid(schema, _all, collectionType) &&
valid(schema, _scheme, collectionType) &&
@@ -50,9 +46,7 @@ UriField::broken(const Schema &schema,
}
bool
-UriField::valid(const Schema &schema,
- const Schema::CollectionType &
- collectionType) const
+UriField::valid(const Schema &schema, const Schema::CollectionType & collectionType) const
{
return valid(schema, _all, collectionType) &&
valid(schema, _scheme, collectionType) &&
@@ -64,8 +58,7 @@ UriField::valid(const Schema &schema,
}
void
-UriField::setup(const Schema &schema,
- const vespalib::string &field)
+UriField::setup(const Schema &schema, const vespalib::string &field)
{
_all = schema.getIndexFieldId(field);
_scheme = schema.getIndexFieldId(field + ".scheme");
@@ -77,9 +70,19 @@ UriField::setup(const Schema &schema,
_hostname = schema.getIndexFieldId(field + ".hostname");
}
+bool
+UriField::mightBePartofUri(vespalib::stringref name) {
+ size_t dotPos = name.find('.');
+ if ((dotPos != 0) && (dotPos != vespalib::string::npos)) {
+ vespalib::stringref suffix = name.substr(dotPos + 1);
+ return ((suffix == "all") || (suffix == "scheme") || (suffix == "host") || (suffix == "port") ||
+ (suffix == "path") || (suffix == "query") || (suffix == "fragment") || (suffix == "hostname"));
+ }
+ return false;
+}
+
void
-UriField::markUsed(UsedFieldsMap &usedFields,
- uint32_t field)
+UriField::markUsed(UsedFieldsMap &usedFields, uint32_t field)
{
if (field == Schema::UNKNOWN_FIELD_ID) {
return;
diff --git a/searchlib/src/vespa/searchlib/index/uri_field.h b/searchlib/src/vespa/searchlib/index/uri_field.h
index 9b8e4e72b7c..70bf8c01a8c 100644
--- a/searchlib/src/vespa/searchlib/index/uri_field.h
+++ b/searchlib/src/vespa/searchlib/index/uri_field.h
@@ -35,6 +35,7 @@ public:
bool valid(const Schema &schema, const Schema::CollectionType &collectionType) const;
void setup(const Schema &schema, const vespalib::string &field);
void markUsed(UsedFieldsMap &usedFields) const;
+ static bool mightBePartofUri(vespalib::stringref name);
};
}
diff --git a/searchsummary/src/vespa/searchsummary/docsummary/dynamicteaserdfw.cpp b/searchsummary/src/vespa/searchsummary/docsummary/dynamicteaserdfw.cpp
index 024046b679b..d9878cd2057 100644
--- a/searchsummary/src/vespa/searchsummary/docsummary/dynamicteaserdfw.cpp
+++ b/searchsummary/src/vespa/searchsummary/docsummary/dynamicteaserdfw.cpp
@@ -375,40 +375,35 @@ DynamicTeaserDFW::makeDynamicTeaser(uint32_t docid, vespalib::stringref input, G
state->_dynteaser._query = _juniper->CreateQueryHandle(iq, nullptr);
}
- if (docid != state->_dynteaser._docid ||
- _inputFieldEnumValue != state->_dynteaser._input ||
- _langFieldEnumValue != state->_dynteaser._lang ||
- !juniper::AnalyseCompatible(_juniperConfig.get(), state->_dynteaser._config)) {
- LOG(debug, "makeDynamicTeaser: docid (%d,%d), fieldenum (%d,%d), lang (%d,%d) analyse %s",
- docid, state->_dynteaser._docid,
- _inputFieldEnumValue, state->_dynteaser._input,
- _langFieldEnumValue, state->_dynteaser._lang,
- (juniper::AnalyseCompatible(_juniperConfig.get(), state->_dynteaser._config) ? "no" : "yes"));
-
- if (state->_dynteaser._result != nullptr)
- juniper::ReleaseResult(state->_dynteaser._result);
-
- state->_dynteaser._docid = docid;
- state->_dynteaser._input = _inputFieldEnumValue;
- state->_dynteaser._lang = _langFieldEnumValue;
- state->_dynteaser._config = _juniperConfig.get();
- state->_dynteaser._result = nullptr;
-
- if (state->_dynteaser._query != nullptr) {
-
- if (LOG_WOULD_LOG(spam)) {
- std::ostringstream hexDump;
- hexDump << vespalib::HexDump(input.data(), input.length());
- LOG(spam, "makeDynamicTeaser: docid=%d, input='%s', hexdump:\n%s",
- docid, std::string(input.data(), input.length()).c_str(), hexDump.str().c_str());
- }
+ LOG(debug, "makeDynamicTeaser: docid (%d,%d), fieldenum (%d,%d), lang (%d,%d) analyse %s",
+ docid, state->_dynteaser._docid,
+ _inputFieldEnumValue, state->_dynteaser._input,
+ _langFieldEnumValue, state->_dynteaser._lang,
+ (juniper::AnalyseCompatible(_juniperConfig.get(), state->_dynteaser._config) ? "no" : "yes"));
+
+ if (state->_dynteaser._result != nullptr)
+ juniper::ReleaseResult(state->_dynteaser._result);
+
+ state->_dynteaser._docid = docid;
+ state->_dynteaser._input = _inputFieldEnumValue;
+ state->_dynteaser._lang = _langFieldEnumValue;
+ state->_dynteaser._config = _juniperConfig.get();
+ state->_dynteaser._result = nullptr;
+
+ if (state->_dynteaser._query != nullptr) {
+
+ if (LOG_WOULD_LOG(spam)) {
+ std::ostringstream hexDump;
+ hexDump << vespalib::HexDump(input.data(), input.length());
+ LOG(spam, "makeDynamicTeaser: docid=%d, input='%s', hexdump:\n%s",
+ docid, std::string(input.data(), input.length()).c_str(), hexDump.str().c_str());
+ }
- auto langid = static_cast<uint32_t>(-1);
+ auto langid = static_cast<uint32_t>(-1);
- state->_dynteaser._result =
- juniper::Analyse(_juniperConfig.get(), state->_dynteaser._query,
- input.data(), input.length(), docid, _inputFieldEnumValue, langid);
- }
+ state->_dynteaser._result =
+ juniper::Analyse(_juniperConfig.get(), state->_dynteaser._query,
+ input.data(), input.length(), docid, _inputFieldEnumValue, langid);
}
juniper::Summary *teaser = (state->_dynteaser._result != nullptr)
diff --git a/vespalog/CMakeLists.txt b/vespalog/CMakeLists.txt
index 45410a1d29d..cc419681445 100644
--- a/vespalog/CMakeLists.txt
+++ b/vespalog/CMakeLists.txt
@@ -17,6 +17,5 @@ vespa_define_module(
src/test/threads
)
-vespa_install_script(src/vespa-logfmt/vespa-logfmt.pl vespa-logfmt bin)
install(FILES src/vespa-logfmt/vespa-logfmt.1 DESTINATION man/man1)
install(DIRECTORY DESTINATION var/db/vespa/logcontrol)