summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--searchcommon/src/vespa/searchcommon/attribute/basictype.h9
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/indexenvironment.cpp60
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/indexenvironment.h48
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/match_master.cpp13
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/searchview.cpp4
-rw-r--r--searchlib/src/vespa/searchlib/queryeval/hitcollector.h9
6 files changed, 46 insertions, 97 deletions
diff --git a/searchcommon/src/vespa/searchcommon/attribute/basictype.h b/searchcommon/src/vespa/searchcommon/attribute/basictype.h
index 3a2a319afd8..5bc51cdbea8 100644
--- a/searchcommon/src/vespa/searchcommon/attribute/basictype.h
+++ b/searchcommon/src/vespa/searchcommon/attribute/basictype.h
@@ -27,13 +27,10 @@ class BasicType
MAX_TYPE
};
- explicit
- BasicType(int t) : _type(Type(t)) { }
- explicit
- BasicType(unsigned int t) : _type(Type(t)) { }
+ explicit BasicType(int t) : _type(Type(t)) { }
+ explicit BasicType(unsigned int t) : _type(Type(t)) { }
BasicType(Type t) : _type(t) { }
- explicit
- BasicType(const vespalib::string & t) : _type(asType(t)) { }
+ explicit BasicType(const vespalib::string & t) : _type(asType(t)) { }
Type type() const { return _type; }
const char * asString() const { return asString(_type); }
diff --git a/searchcore/src/vespa/searchcore/proton/matching/indexenvironment.cpp b/searchcore/src/vespa/searchcore/proton/matching/indexenvironment.cpp
index d8fc9557023..9be1156b154 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/indexenvironment.cpp
+++ b/searchcore/src/vespa/searchcore/proton/matching/indexenvironment.cpp
@@ -8,8 +8,7 @@
using namespace search::fef;
-namespace proton {
-namespace matching {
+namespace proton::matching {
void
IndexEnvironment::extractFields(const search::index::Schema &schema)
@@ -17,29 +16,20 @@ IndexEnvironment::extractFields(const search::index::Schema &schema)
typedef search::index::Schema::Field SchemaField;
for (uint32_t i = 0; i < schema.getNumAttributeFields(); ++i) {
const SchemaField &field = schema.getAttributeField(i);
- FieldInfo fieldInfo(FieldType::ATTRIBUTE,
- field.getCollectionType(),
- field.getName(), _fields.size());
+ FieldInfo fieldInfo(FieldType::ATTRIBUTE, field.getCollectionType(), field.getName(), _fields.size());
fieldInfo.set_data_type(field.getDataType());
insertField(fieldInfo);
}
for (uint32_t i = 0; i < schema.getNumIndexFields(); ++i) {
const SchemaField &field = schema.getIndexField(i);
- FieldInfo fieldInfo(FieldType::INDEX,
- field.getCollectionType(),
- field.getName(), _fields.size());
+ FieldInfo fieldInfo(FieldType::INDEX, field.getCollectionType(), field.getName(), _fields.size());
fieldInfo.set_data_type(field.getDataType());
- if (indexproperties::IsFilterField::check(
- _properties, field.getName()))
- {
+ if (indexproperties::IsFilterField::check(_properties, field.getName())) {
fieldInfo.setFilter(true);
}
FieldNameMap::const_iterator itr = _fieldNames.find(field.getName());
if (itr != _fieldNames.end()) { // override the attribute field
- FieldInfo shadow_field(fieldInfo.type(),
- fieldInfo.collection(),
- fieldInfo.name(),
- itr->second);
+ FieldInfo shadow_field(fieldInfo.type(), fieldInfo.collection(), fieldInfo.name(), itr->second);
shadow_field.set_data_type(fieldInfo.get_data_type());
shadow_field.addAttribute(); // tell ranking about the shadowed attribute
_fields[itr->second] = shadow_field;
@@ -48,19 +38,15 @@ IndexEnvironment::extractFields(const search::index::Schema &schema)
}
}
for (const auto &attr : schema.getImportedAttributeFields()) {
- FieldInfo field(FieldType::ATTRIBUTE,
- attr.getCollectionType(),
- attr.getName(), _fields.size());
+ FieldInfo field(FieldType::ATTRIBUTE, attr.getCollectionType(), attr.getName(), _fields.size());
field.set_data_type(attr.getDataType());
insertField(field);
}
//TODO: This is a kludge to get [documentmetastore] searchable
{
- FieldInfo fieldInfo(FieldType::HIDDEN_ATTRIBUTE,
- FieldInfo::CollectionType::SINGLE,
- DocumentMetaStore::getFixedName(),
- _fields.size());
+ FieldInfo fieldInfo(FieldType::HIDDEN_ATTRIBUTE, FieldInfo::CollectionType::SINGLE,
+ DocumentMetaStore::getFixedName(), _fields.size());
fieldInfo.set_data_type(FieldInfo::DataType::RAW);
fieldInfo.setFilter(true);
insertField(fieldInfo);
@@ -85,9 +71,7 @@ IndexEnvironment::IndexEnvironment(const search::index::Schema &schema,
_motivation(UNKNOWN),
_constantValueRepo(constantValueRepo)
{
- _tableManager.addFactory(
- search::fef::ITableFactory::SP(
- new search::fef::FunctionTableFactory(256)));
+ _tableManager.addFactory(std::make_shared<search::fef::FunctionTableFactory>(256));
extractFields(schema);
}
@@ -124,38 +108,26 @@ IndexEnvironment::getFieldByName(const string &name) const
}
const search::fef::ITableManager &
-IndexEnvironment::getTableManager() const
-{
+IndexEnvironment::getTableManager() const {
return _tableManager;
}
IIndexEnvironment::FeatureMotivation
-IndexEnvironment::getFeatureMotivation() const
-{
+IndexEnvironment::getFeatureMotivation() const {
return _motivation;
}
void
-IndexEnvironment::hintFeatureMotivation(FeatureMotivation motivation) const
-{
+IndexEnvironment::hintFeatureMotivation(FeatureMotivation motivation) const {
_motivation = motivation;
}
void
-IndexEnvironment::hintFieldAccess(uint32_t fieldId) const
-{
- (void) fieldId;
-}
+IndexEnvironment::hintFieldAccess(uint32_t ) const { }
void
-IndexEnvironment::hintAttributeAccess(const string &name) const
-{
- (void) name;
-}
+IndexEnvironment::hintAttributeAccess(const string &) const { }
-IndexEnvironment::~IndexEnvironment()
-{
-}
+IndexEnvironment::~IndexEnvironment() = default;
-} // namespace matching
-} // namespace proton
+}
diff --git a/searchcore/src/vespa/searchcore/proton/matching/indexenvironment.h b/searchcore/src/vespa/searchcore/proton/matching/indexenvironment.h
index 09ff1fef2ea..a17ef1677a5 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/indexenvironment.h
+++ b/searchcore/src/vespa/searchcore/proton/matching/indexenvironment.h
@@ -10,8 +10,7 @@
#include <vespa/searchcommon/common/schema.h>
#include <vespa/eval/eval/value_cache/constant_value.h>
-namespace proton {
-namespace matching {
+namespace proton::matching {
/**
* Index environment implementation for the proton matching pipeline.
@@ -47,40 +46,21 @@ public:
const search::fef::Properties &props,
const IConstantValueRepo &constantValueRepo);
- // inherited from search::fef::IIndexEnvironment
- virtual const search::fef::Properties &getProperties() const override;
-
- // inherited from search::fef::IIndexEnvironment
- virtual uint32_t getNumFields() const override;
-
- // inherited from search::fef::IIndexEnvironment
- virtual const search::fef::FieldInfo *getField(uint32_t id) const override;
-
- // inherited from search::fef::IIndexEnvironment
- virtual const search::fef::FieldInfo *
- getFieldByName(const string &name) const override;
-
- // inherited from search::fef::IIndexEnvironment
- virtual const search::fef::ITableManager &getTableManager() const override;
-
- virtual FeatureMotivation getFeatureMotivation() const override;
-
- // inherited from search::fef::IIndexEnvironment
- virtual void hintFeatureMotivation(FeatureMotivation motivation) const override;
-
- // inherited from search::fef::IIndexEnvironment
- virtual void hintFieldAccess(uint32_t fieldId) const override;
-
- // inherited from search::fef::IIndexEnvironment
- virtual void hintAttributeAccess(const string &name) const override;
-
- virtual vespalib::eval::ConstantValue::UP getConstantValue(const vespalib::string &name) const override {
+ const search::fef::Properties &getProperties() const override;
+ uint32_t getNumFields() const override;
+ const search::fef::FieldInfo *getField(uint32_t id) const override;
+ const search::fef::FieldInfo *getFieldByName(const string &name) const override;
+ const search::fef::ITableManager &getTableManager() const override;
+ FeatureMotivation getFeatureMotivation() const override;
+ void hintFeatureMotivation(FeatureMotivation motivation) const override;
+ void hintFieldAccess(uint32_t fieldId) const override;
+ void hintAttributeAccess(const string &name) const override;
+
+ vespalib::eval::ConstantValue::UP getConstantValue(const vespalib::string &name) const override {
return _constantValueRepo.getConstant(name);
}
- virtual ~IndexEnvironment();
+ ~IndexEnvironment() override;
};
-} // namespace matching
-} // namespace proton
-
+}
diff --git a/searchcore/src/vespa/searchcore/proton/matching/match_master.cpp b/searchcore/src/vespa/searchcore/proton/matching/match_master.cpp
index ec3f1c7223f..6bce05b6c26 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/match_master.cpp
+++ b/searchcore/src/vespa/searchcore/proton/matching/match_master.cpp
@@ -69,10 +69,9 @@ MatchMaster::match(const MatchParams &params,
std::vector<MatchThread::UP> threadState;
std::vector<vespalib::Runnable*> targets;
for (size_t i = 0; i < threadBundle.size(); ++i) {
- IMatchLoopCommunicator &com =
- (i == 0)?
- static_cast<IMatchLoopCommunicator&>(timedCommunicator) :
- static_cast<IMatchLoopCommunicator&>(communicator);
+ IMatchLoopCommunicator &com = (i == 0)
+ ? static_cast<IMatchLoopCommunicator&>(timedCommunicator)
+ : static_cast<IMatchLoopCommunicator&>(communicator);
threadState.emplace_back(std::make_unique<MatchThread>(i, threadBundle.size(),
params, matchToolsFactory, com, *scheduler,
resultProcessor, mergeDirector, distributionKey));
@@ -101,10 +100,10 @@ MatchMaster::match(const MatchParams &params,
}
FeatureSet::SP
-MatchMaster::getFeatureSet(const MatchToolsFactory &matchToolsFactory,
+MatchMaster::getFeatureSet(const MatchToolsFactory &mtf,
const std::vector<uint32_t> &docs, bool summaryFeatures)
{
- MatchTools::UP matchTools = matchToolsFactory.createMatchTools();
+ MatchTools::UP matchTools = mtf.createMatchTools();
if (summaryFeatures) {
matchTools->setup_summary();
} else {
@@ -118,7 +117,7 @@ MatchMaster::getFeatureSet(const MatchToolsFactory &matchToolsFactory,
for (size_t i = 0; i < resolver.num_features(); ++i) {
featureNames.emplace_back(resolver.name_of(i));
}
- FeatureSet::SP retval(new FeatureSet(featureNames, docs.size()));
+ auto retval = std::make_shared<FeatureSet>(featureNames, docs.size());
if (docs.empty()) {
return retval;
}
diff --git a/searchcore/src/vespa/searchcore/proton/server/searchview.cpp b/searchcore/src/vespa/searchcore/proton/server/searchview.cpp
index 1e22eec2d55..232f0bdba6c 100644
--- a/searchcore/src/vespa/searchcore/proton/server/searchview.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/searchview.cpp
@@ -96,7 +96,7 @@ convertLidsToGids(DocsumReply &reply, const DocsumRequest &request)
DocsumReply::UP
createEmptyReply(const DocsumRequest & request)
{
- DocsumReply::UP reply(new DocsumReply());
+ auto reply = std::make_unique<DocsumReply>();
for (size_t i = 0; i < request.hits.size(); ++i) {
reply->docsums.push_back(DocsumReply::Docsum());
reply->docsums.back().gid = request.hits[i].gid;
@@ -113,7 +113,7 @@ SearchView::SearchView(const ISummaryManager::ISummarySetup::SP & summarySetup,
_matchView(matchView)
{ }
-SearchView::~SearchView() {}
+SearchView::~SearchView() = default;
DocsumReply::UP
SearchView::getDocsums(const DocsumRequest & req)
diff --git a/searchlib/src/vespa/searchlib/queryeval/hitcollector.h b/searchlib/src/vespa/searchlib/queryeval/hitcollector.h
index 4429d28d1a4..97beaa0fd55 100644
--- a/searchlib/src/vespa/searchlib/queryeval/hitcollector.h
+++ b/searchlib/src/vespa/searchlib/queryeval/hitcollector.h
@@ -141,6 +141,9 @@ private:
VESPA_DLL_LOCAL void sortHitsByDocId();
public:
+ HitCollector(const HitCollector &) = delete;
+ HitCollector &operator=(const HitCollector &) = delete;
+
/**
* Creates a hit collector used to store hits for doc ids in the
* range [0, numDocs>. Doc id and rank score are stored for the n
@@ -174,6 +177,8 @@ public:
*/
SortedHitSequence getSortedHitSequence(size_t max_hits);
+ const std::vector<Hit> & getReRankedHits() const { return _reRankedHits; }
+
/**
* Re-ranks the given hits by invoking the score() method on the
* given document scorer. The hits are sorted on doc id so that
@@ -193,10 +198,6 @@ public:
* @param default_value rank value to be used for results without rank value
**/
std::unique_ptr<ResultSet> getResultSet(HitRank default_value = default_rank_value);
-
-private:
- HitCollector(const HitCollector &); // Not implemented
- HitCollector &operator=(const HitCollector &); // Not implemented
};
}