aboutsummaryrefslogtreecommitdiffstats
path: root/searchlib
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2024-02-10 10:53:23 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2024-02-10 11:06:23 +0000
commit70992eaea2cb8e0116e196a15bc5493d2cf85810 (patch)
tree040689361311a4fbee57784ca534baee9eb76e93 /searchlib
parent47498126e5dd7c706431ef55305c29c79843da3e (diff)
- DocId is an overloaded type already. Just use string as directly for readability.
- Add noexcept and and using.
Diffstat (limited to 'searchlib')
-rw-r--r--searchlib/src/vespa/searchlib/aggregation/hitsaggregationresult.h10
-rw-r--r--searchlib/src/vespa/searchlib/aggregation/vdshit.h16
-rw-r--r--searchlib/src/vespa/searchlib/index/indexbuilder.h14
3 files changed, 20 insertions, 20 deletions
diff --git a/searchlib/src/vespa/searchlib/aggregation/hitsaggregationresult.h b/searchlib/src/vespa/searchlib/aggregation/hitsaggregationresult.h
index 0bf33ea33e8..f90ee3c2312 100644
--- a/searchlib/src/vespa/searchlib/aggregation/hitsaggregationresult.h
+++ b/searchlib/src/vespa/searchlib/aggregation/hitsaggregationresult.h
@@ -16,8 +16,8 @@ public:
class SummaryGenerator
{
public:
- virtual ~SummaryGenerator() { }
- virtual vespalib::ConstBufferRef fillSummary(DocId lid, const SummaryClassType & summaryClass) = 0;
+ virtual ~SummaryGenerator() = default;
+ virtual vespalib::ConstBufferRef fillSummary(DocId lid, vespalib::stringref summaryClass) = 0;
};
private:
@@ -26,7 +26,7 @@ private:
void onAggregate(const ResultNode &result, const document::Document & doc, HitRank rank) override;
const ResultNode & onGetRank() const override;
- SummaryClassType _summaryClass;
+ vespalib::string _summaryClass;
uint32_t _maxHits;
HitList _hits;
bool _isOrdered;
@@ -50,8 +50,8 @@ public:
~HitsAggregationResult() override;
void postMerge() override { _hits.postMerge(_maxHits); }
void setSummaryGenerator(SummaryGenerator & summaryGenerator) { _summaryGenerator = &summaryGenerator; }
- const SummaryClassType & getSummaryClass() const { return _summaryClass; }
- HitsAggregationResult setSummaryClass(const SummaryClassType & summaryClass) { _summaryClass = summaryClass; return *this; }
+ const vespalib::string & getSummaryClass() const { return _summaryClass; }
+ HitsAggregationResult setSummaryClass(vespalib::stringref summaryClass) { _summaryClass = summaryClass; return *this; }
HitsAggregationResult &setMaxHits(uint32_t maxHits) {
_maxHits = (maxHits == 0) ? std::numeric_limits<uint32_t>::max() : maxHits;
return *this;
diff --git a/searchlib/src/vespa/searchlib/aggregation/vdshit.h b/searchlib/src/vespa/searchlib/aggregation/vdshit.h
index 11cfe9b3b18..32a35c22977 100644
--- a/searchlib/src/vespa/searchlib/aggregation/vdshit.h
+++ b/searchlib/src/vespa/searchlib/aggregation/vdshit.h
@@ -2,7 +2,6 @@
#pragma once
#include "hit.h"
-#include "aggregationresult.h"
namespace search::aggregation {
@@ -10,19 +9,18 @@ class VdsHit : public Hit
{
public:
using Summary = std::vector<uint8_t>;
- using DocId = vespalib::string;
DECLARE_IDENTIFIABLE_NS2(search, aggregation, VdsHit);
DECLARE_NBO_SERIALIZE;
VdsHit() noexcept : Hit(), _docId(), _summary() {}
- VdsHit(DocId docId, HitRank rank) noexcept : Hit(rank), _docId(docId), _summary() {}
- ~VdsHit();
+ VdsHit(vespalib::stringref docId, HitRank rank) noexcept : Hit(rank), _docId(docId), _summary() {}
+ ~VdsHit() override;
VdsHit *clone() const override { return new VdsHit(*this); }
void visitMembers(vespalib::ObjectVisitor &visitor) const override;
- const DocId & getDocId() const noexcept { return _docId; }
+ const vespalib::string & getDocId() const noexcept { return _docId; }
const Summary & getSummary() const noexcept { return _summary; }
- VdsHit & setDocId(DocId & docId) noexcept { _docId = docId; return *this; }
+ VdsHit & setDocId(vespalib::stringref docId) noexcept { _docId = docId; return *this; }
VdsHit & setSummary(const void * buf, size_t sz) noexcept {
- const uint8_t * v(static_cast<const uint8_t *>(buf));
+ const auto * v(static_cast<const uint8_t *>(buf));
Summary n(v, v+sz);
_summary.swap(n);
return *this;
@@ -30,8 +28,8 @@ public:
bool operator < (const VdsHit &b) const noexcept { return cmp(b) < 0; }
private:
- DocId _docId;
- Summary _summary;
+ vespalib::string _docId;
+ Summary _summary;
};
}
diff --git a/searchlib/src/vespa/searchlib/index/indexbuilder.h b/searchlib/src/vespa/searchlib/index/indexbuilder.h
index 9615bfd9428..71b826698ef 100644
--- a/searchlib/src/vespa/searchlib/index/indexbuilder.h
+++ b/searchlib/src/vespa/searchlib/index/indexbuilder.h
@@ -10,6 +10,13 @@ class DocIdAndFeatures;
class Schema;
class WordDocElementWordPosFeatures;
+/**
+ * Interface for building an index for a single field
+ * The index should be built as follows:
+ * Add the set of unique words in sorted order.
+ * For each word add the set of document ids in sorted order.
+ * For each document id add the position information for that document.
+ */
class FieldIndexBuilder {
public:
virtual ~FieldIndexBuilder() = default;
@@ -20,16 +27,11 @@ public:
/**
* Interface used to build an index for the set of index fields specified in a schema.
- *
- * The index should be built as follows:
- * For each field add the set of unique words in sorted order.
- * For each word add the set of document ids in sorted order.
- * For each document id add the position information for that document.
+ * Create and complete one field builder at the time.
*/
class IndexBuilder {
protected:
const Schema &_schema;
-
public:
explicit IndexBuilder(const Schema &schema);
virtual ~IndexBuilder();