summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2023-08-29 20:14:19 +0200
committerGitHub <noreply@github.com>2023-08-29 20:14:19 +0200
commit306dce28ed3cfa0d2f4679fd2519db3d1ac780c7 (patch)
treeae3cbd05597816f033fc5f8945dab62a838c92bb
parent2b222c336e1518c929f93808f9e1366a434671e5 (diff)
parentf52f8a01507163de2db95456dd6e344a0c40d748 (diff)
Merge pull request #28251 from vespa-engine/geirst/searchcore-code-cleanup
Searchcore code cleanup
-rw-r--r--searchcore/src/tests/grouping/CMakeLists.txt2
-rw-r--r--searchcore/src/tests/grouping/grouping_test.cpp (renamed from searchcore/src/tests/grouping/grouping.cpp)0
-rw-r--r--searchcore/src/tests/proton/common/cachedselect_test.cpp2
-rw-r--r--searchcore/src/tests/proton/documentdb/feedview/feedview_test.cpp6
-rw-r--r--searchcore/src/tests/proton/documentdb/maintenancecontroller/maintenancecontroller_test.cpp2
-rw-r--r--searchcore/src/tests/proton/feed_and_search/CMakeLists.txt2
-rw-r--r--searchcore/src/tests/proton/feed_and_search/feed_and_search_test.cpp (renamed from searchcore/src/tests/proton/feed_and_search/feed_and_search.cpp)0
-rw-r--r--searchcore/src/tests/proton/feedtoken/CMakeLists.txt2
-rw-r--r--searchcore/src/tests/proton/feedtoken/feedtoken_test.cpp (renamed from searchcore/src/tests/proton/feedtoken/feedtoken.cpp)0
-rw-r--r--searchcore/src/tests/proton/flushengine/flushengine_test.cpp2
-rw-r--r--searchcore/src/tests/proton/matchengine/CMakeLists.txt2
-rw-r--r--searchcore/src/tests/proton/matchengine/matchengine_test.cpp (renamed from searchcore/src/tests/proton/matchengine/matchengine.cpp)0
-rw-r--r--searchcore/src/tests/proton/proton_config_fetcher/proton_config_fetcher_test.cpp6
-rw-r--r--searchcore/src/tests/proton/statusreport/CMakeLists.txt2
-rw-r--r--searchcore/src/tests/proton/statusreport/statusreport_test.cpp (renamed from searchcore/src/tests/proton/statusreport/statusreport.cpp)0
-rw-r--r--searchcore/src/tests/proton/summaryengine/CMakeLists.txt2
-rw-r--r--searchcore/src/tests/proton/summaryengine/summaryengine_test.cpp (renamed from searchcore/src/tests/proton/summaryengine/summaryengine.cpp)0
-rw-r--r--searchcore/src/vespa/searchcore/proton/feedoperation/lidvectorcontext.cpp6
-rw-r--r--searchcore/src/vespa/searchcore/proton/feedoperation/removedocumentsoperation.h2
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/viewresolver.cpp2
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/matchers.cpp2
-rw-r--r--searchcore/src/vespa/searchcore/proton/test/userdocuments.h2
22 files changed, 21 insertions, 23 deletions
diff --git a/searchcore/src/tests/grouping/CMakeLists.txt b/searchcore/src/tests/grouping/CMakeLists.txt
index cacdda484be..b127132cbae 100644
--- a/searchcore/src/tests/grouping/CMakeLists.txt
+++ b/searchcore/src/tests/grouping/CMakeLists.txt
@@ -1,7 +1,7 @@
# Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
vespa_add_executable(searchcore_grouping_test_app TEST
SOURCES
- grouping.cpp
+ grouping_test.cpp
DEPENDS
searchcore_grouping
searchcore_matching
diff --git a/searchcore/src/tests/grouping/grouping.cpp b/searchcore/src/tests/grouping/grouping_test.cpp
index 015aec73999..015aec73999 100644
--- a/searchcore/src/tests/grouping/grouping.cpp
+++ b/searchcore/src/tests/grouping/grouping_test.cpp
diff --git a/searchcore/src/tests/proton/common/cachedselect_test.cpp b/searchcore/src/tests/proton/common/cachedselect_test.cpp
index 9a9d491467c..02c5128a0a7 100644
--- a/searchcore/src/tests/proton/common/cachedselect_test.cpp
+++ b/searchcore/src/tests/proton/common/cachedselect_test.cpp
@@ -289,7 +289,7 @@ MyDB::addDoc(uint32_t lid,
const Document &
MyDB::getDoc(uint32_t lid) const
{
- LidToDocSP::const_iterator it(_lidToDocSP.find(lid));
+ auto it = _lidToDocSP.find(lid);
ASSERT_TRUE(it != _lidToDocSP.end());
return *it->second;
}
diff --git a/searchcore/src/tests/proton/documentdb/feedview/feedview_test.cpp b/searchcore/src/tests/proton/documentdb/feedview/feedview_test.cpp
index fdfa7522350..62be83f5f51 100644
--- a/searchcore/src/tests/proton/documentdb/feedview/feedview_test.cpp
+++ b/searchcore/src/tests/proton/documentdb/feedview/feedview_test.cpp
@@ -239,12 +239,12 @@ struct MyDocumentStore : public test::DummyDocumentStore
{}
~MyDocumentStore() override;
Document::UP read(DocumentIdT lid, const document::DocumentTypeRepo &) const override {
- DocMap::const_iterator itr = _docs.find(lid);
+ auto itr = _docs.find(lid);
if (itr != _docs.end()) {
Document::UP retval(itr->second->clone());
return retval;
}
- return Document::UP();
+ return {};
}
void write(uint64_t syncToken, DocumentIdT lid, const document::Document& doc) override {
_lastSyncToken = syncToken;
@@ -345,7 +345,7 @@ struct MyAttributeWriter : public IAttributeWriter
if (_attrs.count(attrName) == 0) {
return nullptr;
}
- AttrMap::const_iterator itr = _attrMap.find(attrName);
+ auto itr = _attrMap.find(attrName);
return ((itr == _attrMap.end()) ? nullptr : itr->second.get());
}
void put(SerialNum serialNum, const document::Document &doc, DocumentIdT lid, OnWriteDoneType) override {
diff --git a/searchcore/src/tests/proton/documentdb/maintenancecontroller/maintenancecontroller_test.cpp b/searchcore/src/tests/proton/documentdb/maintenancecontroller/maintenancecontroller_test.cpp
index bf960768c89..aeaa35309b5 100644
--- a/searchcore/src/tests/proton/documentdb/maintenancecontroller/maintenancecontroller_test.cpp
+++ b/searchcore/src/tests/proton/documentdb/maintenancecontroller/maintenancecontroller_test.cpp
@@ -193,7 +193,7 @@ struct MyBucketModifiedHandler : public IBucketModifiedHandler
{
BucketIdVector _modified;
void notifyBucketModified(const BucketId &bucket) override {
- BucketIdVector::const_iterator itr = std::find(_modified.begin(), _modified.end(), bucket);
+ auto itr = std::find(_modified.begin(), _modified.end(), bucket);
if (itr == _modified.end()) {
_modified.push_back(bucket);
}
diff --git a/searchcore/src/tests/proton/feed_and_search/CMakeLists.txt b/searchcore/src/tests/proton/feed_and_search/CMakeLists.txt
index 24588d21d99..e7000af18cb 100644
--- a/searchcore/src/tests/proton/feed_and_search/CMakeLists.txt
+++ b/searchcore/src/tests/proton/feed_and_search/CMakeLists.txt
@@ -1,7 +1,7 @@
# Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
vespa_add_executable(searchcore_feed_and_search_test_app TEST
SOURCES
- feed_and_search.cpp
+ feed_and_search_test.cpp
DEPENDS
searchlib_test
)
diff --git a/searchcore/src/tests/proton/feed_and_search/feed_and_search.cpp b/searchcore/src/tests/proton/feed_and_search/feed_and_search_test.cpp
index 6838f61967e..6838f61967e 100644
--- a/searchcore/src/tests/proton/feed_and_search/feed_and_search.cpp
+++ b/searchcore/src/tests/proton/feed_and_search/feed_and_search_test.cpp
diff --git a/searchcore/src/tests/proton/feedtoken/CMakeLists.txt b/searchcore/src/tests/proton/feedtoken/CMakeLists.txt
index 8cf242dd3c1..0e4f3a2a08c 100644
--- a/searchcore/src/tests/proton/feedtoken/CMakeLists.txt
+++ b/searchcore/src/tests/proton/feedtoken/CMakeLists.txt
@@ -1,7 +1,7 @@
# Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
vespa_add_executable(searchcore_feedtoken_test_app TEST
SOURCES
- feedtoken.cpp
+ feedtoken_test.cpp
DEPENDS
searchcore_pcommon
searchcore_proton_metrics
diff --git a/searchcore/src/tests/proton/feedtoken/feedtoken.cpp b/searchcore/src/tests/proton/feedtoken/feedtoken_test.cpp
index 19521dfb4f9..19521dfb4f9 100644
--- a/searchcore/src/tests/proton/feedtoken/feedtoken.cpp
+++ b/searchcore/src/tests/proton/feedtoken/feedtoken_test.cpp
diff --git a/searchcore/src/tests/proton/flushengine/flushengine_test.cpp b/searchcore/src/tests/proton/flushengine/flushengine_test.cpp
index 6cdf0c478ad..2c589085a90 100644
--- a/searchcore/src/tests/proton/flushengine/flushengine_test.cpp
+++ b/searchcore/src/tests/proton/flushengine/flushengine_test.cpp
@@ -691,7 +691,7 @@ bool
asserCorrectHandlers(const FlushEngine::FlushMetaSet & current1, const std::vector<const char *> & targets)
{
bool retval(targets.size() == current1.size());
- FlushEngine::FlushMetaSet::const_iterator curr(current1.begin());
+ auto curr = current1.begin();
if (retval) {
for (const char * target : targets) {
if (target != (curr++)->getName()) {
diff --git a/searchcore/src/tests/proton/matchengine/CMakeLists.txt b/searchcore/src/tests/proton/matchengine/CMakeLists.txt
index 1a91fd2a799..1452dc20737 100644
--- a/searchcore/src/tests/proton/matchengine/CMakeLists.txt
+++ b/searchcore/src/tests/proton/matchengine/CMakeLists.txt
@@ -1,7 +1,7 @@
# Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
vespa_add_executable(searchcore_matchengine_test_app TEST
SOURCES
- matchengine.cpp
+ matchengine_test.cpp
DEPENDS
searchcore_matchengine
searchcore_matching
diff --git a/searchcore/src/tests/proton/matchengine/matchengine.cpp b/searchcore/src/tests/proton/matchengine/matchengine_test.cpp
index 514c9038945..514c9038945 100644
--- a/searchcore/src/tests/proton/matchengine/matchengine.cpp
+++ b/searchcore/src/tests/proton/matchengine/matchengine_test.cpp
diff --git a/searchcore/src/tests/proton/proton_config_fetcher/proton_config_fetcher_test.cpp b/searchcore/src/tests/proton/proton_config_fetcher/proton_config_fetcher_test.cpp
index caedd363481..4a223967a89 100644
--- a/searchcore/src/tests/proton/proton_config_fetcher/proton_config_fetcher_test.cpp
+++ b/searchcore/src/tests/proton/proton_config_fetcher/proton_config_fetcher_test.cpp
@@ -123,8 +123,7 @@ struct ConfigTestFixture {
void removeDocType(const std::string & name)
{
- for (DocumenttypesConfigBuilder::DocumenttypeVector::iterator it(documenttypesBuilder.documenttype.begin()),
- mt(documenttypesBuilder.documenttype.end());
+ for (auto it(documenttypesBuilder.documenttype.begin()), mt(documenttypesBuilder.documenttype.end());
it != mt;
it++) {
if ((*it).name.compare(name) == 0) {
@@ -133,8 +132,7 @@ struct ConfigTestFixture {
}
}
- for (ProtonConfigBuilder::DocumentdbVector::iterator it(protonBuilder.documentdb.begin()),
- mt(protonBuilder.documentdb.end());
+ for (auto it(protonBuilder.documentdb.begin()), mt(protonBuilder.documentdb.end());
it != mt;
it++) {
if ((*it).inputdoctypename.compare(name) == 0) {
diff --git a/searchcore/src/tests/proton/statusreport/CMakeLists.txt b/searchcore/src/tests/proton/statusreport/CMakeLists.txt
index 155743b0795..5403857cd4f 100644
--- a/searchcore/src/tests/proton/statusreport/CMakeLists.txt
+++ b/searchcore/src/tests/proton/statusreport/CMakeLists.txt
@@ -1,7 +1,7 @@
# Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
vespa_add_executable(searchcore_statusreport_test_app TEST
SOURCES
- statusreport.cpp
+ statusreport_test.cpp
DEPENDS
searchcore_pcommon
)
diff --git a/searchcore/src/tests/proton/statusreport/statusreport.cpp b/searchcore/src/tests/proton/statusreport/statusreport_test.cpp
index 10520912b2a..10520912b2a 100644
--- a/searchcore/src/tests/proton/statusreport/statusreport.cpp
+++ b/searchcore/src/tests/proton/statusreport/statusreport_test.cpp
diff --git a/searchcore/src/tests/proton/summaryengine/CMakeLists.txt b/searchcore/src/tests/proton/summaryengine/CMakeLists.txt
index a32d005decd..599dfd61e49 100644
--- a/searchcore/src/tests/proton/summaryengine/CMakeLists.txt
+++ b/searchcore/src/tests/proton/summaryengine/CMakeLists.txt
@@ -1,7 +1,7 @@
# Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
vespa_add_executable(searchcore_summaryengine_test_app TEST
SOURCES
- summaryengine.cpp
+ summaryengine_test.cpp
DEPENDS
searchcore_summaryengine
searchcore_pcommon
diff --git a/searchcore/src/tests/proton/summaryengine/summaryengine.cpp b/searchcore/src/tests/proton/summaryengine/summaryengine_test.cpp
index f1183c2556a..f1183c2556a 100644
--- a/searchcore/src/tests/proton/summaryengine/summaryengine.cpp
+++ b/searchcore/src/tests/proton/summaryengine/summaryengine_test.cpp
diff --git a/searchcore/src/vespa/searchcore/proton/feedoperation/lidvectorcontext.cpp b/searchcore/src/vespa/searchcore/proton/feedoperation/lidvectorcontext.cpp
index 3aecbc3ca0d..8a4786d337c 100644
--- a/searchcore/src/vespa/searchcore/proton/feedoperation/lidvectorcontext.cpp
+++ b/searchcore/src/vespa/searchcore/proton/feedoperation/lidvectorcontext.cpp
@@ -52,9 +52,9 @@ LidVectorContext::serialize(vespalib::nbostream &os) const
// Use of bitvector when > 1/32 of docs
if (_result.size() > (_docIdLimit / 32)) {
os << static_cast<int32_t>(BITVECTOR);
- BitVector::UP bitVector = BitVector::create(_docIdLimit);
- for (LidVector::const_iterator it(_result.begin()), mt(_result.end()); it != mt; it++) {
- bitVector->setBit(*it);
+ auto bitVector = BitVector::create(_docIdLimit);
+ for (auto docid : _result) {
+ bitVector->setBit(docid);
}
os << *bitVector;
} else {
diff --git a/searchcore/src/vespa/searchcore/proton/feedoperation/removedocumentsoperation.h b/searchcore/src/vespa/searchcore/proton/feedoperation/removedocumentsoperation.h
index cdc738afa11..d0a323b4c9f 100644
--- a/searchcore/src/vespa/searchcore/proton/feedoperation/removedocumentsoperation.h
+++ b/searchcore/src/vespa/searchcore/proton/feedoperation/removedocumentsoperation.h
@@ -30,7 +30,7 @@ public:
const LidVectorContext::SP
getLidsToRemove(uint32_t subDbId) const {
- LidsToRemoveMap::const_iterator found(_lidsToRemoveMap.find(subDbId));
+ auto found = _lidsToRemoveMap.find(subDbId);
return (found != _lidsToRemoveMap.end()) ? found->second : LidVectorContext::SP();
}
diff --git a/searchcore/src/vespa/searchcore/proton/matching/viewresolver.cpp b/searchcore/src/vespa/searchcore/proton/matching/viewresolver.cpp
index b3ccfd26569..f958a8d7c59 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/viewresolver.cpp
+++ b/searchcore/src/vespa/searchcore/proton/matching/viewresolver.cpp
@@ -17,7 +17,7 @@ bool
ViewResolver::resolve(vespalib::stringref view,
std::vector<vespalib::string> &fields) const
{
- Map::const_iterator pos = _map.find(view);
+ auto pos = _map.find(view);
if (pos == _map.end()) {
fields.push_back(view);
return false;
diff --git a/searchcore/src/vespa/searchcore/proton/server/matchers.cpp b/searchcore/src/vespa/searchcore/proton/server/matchers.cpp
index 969e4b9cbdf..e4a3243d6f4 100644
--- a/searchcore/src/vespa/searchcore/proton/server/matchers.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/matchers.cpp
@@ -57,7 +57,7 @@ Matchers::getStats(const vespalib::string &name) const
std::shared_ptr<Matcher>
Matchers::lookup(const vespalib::string &name) const
{
- Map::const_iterator found(_rpmap.find(name));
+ auto found = _rpmap.find(name);
if (found == _rpmap.end()) {
if (_default) {
vespalib::Issue::report(fmt("Failed to find rank-profile '%s'. Falling back to 'default'", name.c_str()));
diff --git a/searchcore/src/vespa/searchcore/proton/test/userdocuments.h b/searchcore/src/vespa/searchcore/proton/test/userdocuments.h
index 60d9ed3d249..15d41919bb8 100644
--- a/searchcore/src/vespa/searchcore/proton/test/userdocuments.h
+++ b/searchcore/src/vespa/searchcore/proton/test/userdocuments.h
@@ -29,7 +29,7 @@ public:
_docs[userId].addDoc(userDoc);
}
const BucketDocuments &getUserDocs(uint32_t userId) const {
- DocMap::const_iterator itr = _docs.find(userId);
+ auto itr = _docs.find(userId);
assert(itr != _docs.end());
return itr->second;
}