summaryrefslogtreecommitdiffstats
path: root/searchcorespi
diff options
context:
space:
mode:
authorGeir Storli <geirst@verizonmedia.com>2019-06-05 14:13:58 +0000
committerGeir Storli <geirst@verizonmedia.com>2019-06-05 14:26:39 +0000
commit168dc65df08bc8ea0907011fd49e20258f61f4a3 (patch)
treebe415e8fd4770d0a662752a75587bab0bdc365d5 /searchcorespi
parent44e013e0ed797985f744da703b8ee87b70da4f6d (diff)
Change searchcorespi::IndexSearchable to also implement the IFieldLengthInspector API.
Currently the memory and disk index implementations return empty field length info for all fields.
Diffstat (limited to 'searchcorespi')
-rw-r--r--searchcorespi/src/vespa/searchcorespi/index/fakeindexsearchable.h5
-rw-r--r--searchcorespi/src/vespa/searchcorespi/index/indexcollection.cpp10
-rw-r--r--searchcorespi/src/vespa/searchcorespi/index/indexcollection.h6
-rw-r--r--searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.cpp7
-rw-r--r--searchcorespi/src/vespa/searchcorespi/index/indexsearchable.h4
-rw-r--r--searchcorespi/src/vespa/searchcorespi/index/warmupindexcollection.cpp18
-rw-r--r--searchcorespi/src/vespa/searchcorespi/index/warmupindexcollection.h3
7 files changed, 46 insertions, 7 deletions
diff --git a/searchcorespi/src/vespa/searchcorespi/index/fakeindexsearchable.h b/searchcorespi/src/vespa/searchcorespi/index/fakeindexsearchable.h
index 9eba40e08a4..3a391363e47 100644
--- a/searchcorespi/src/vespa/searchcorespi/index/fakeindexsearchable.h
+++ b/searchcorespi/src/vespa/searchcorespi/index/fakeindexsearchable.h
@@ -39,6 +39,11 @@ public:
(void) visitor;
}
+ search::index::FieldLengthInfo get_field_length_info(const vespalib::string& field_name) const override {
+ (void) field_name;
+ return search::index::FieldLengthInfo();
+ }
+
};
} // namespace searchcorespi
diff --git a/searchcorespi/src/vespa/searchcorespi/index/indexcollection.cpp b/searchcorespi/src/vespa/searchcorespi/index/indexcollection.cpp
index de4cde956d0..81a43f932ca 100644
--- a/searchcorespi/src/vespa/searchcorespi/index/indexcollection.cpp
+++ b/searchcorespi/src/vespa/searchcorespi/index/indexcollection.cpp
@@ -13,6 +13,7 @@ LOG_SETUP(".searchcorespi.index.indexcollection");
using namespace search::queryeval;
using namespace search::query;
using search::attribute::IAttributeContext;
+using search::index::FieldLengthInfo;
namespace searchcorespi {
@@ -238,4 +239,13 @@ IndexCollection::createBlueprint(const IRequestContext & requestContext,
return visitor.getResult();
}
+FieldLengthInfo
+IndexCollection::get_field_length_info(const vespalib::string& field_name) const
+{
+ if (_sources.empty()) {
+ return FieldLengthInfo();
+ }
+ return _sources.back().source_wrapper->get_field_length_info(field_name);
+}
+
} // namespace searchcorespi
diff --git a/searchcorespi/src/vespa/searchcorespi/index/indexcollection.h b/searchcorespi/src/vespa/searchcorespi/index/indexcollection.h
index eabdddf9dfe..e71f421c3ca 100644
--- a/searchcorespi/src/vespa/searchcorespi/index/indexcollection.h
+++ b/searchcorespi/src/vespa/searchcorespi/index/indexcollection.h
@@ -57,6 +57,12 @@ public:
static ISearchableIndexCollection::UP
replaceAndRenumber(const ISourceSelectorSP & selector, const ISearchableIndexCollection &fsc,
uint32_t id_diff, const IndexSearchable::SP &new_source);
+
+ // Implements IFieldLengthInspector
+ /**
+ * Returns field length info from the newest disk index, or empty info for all fields if no disk index exists.
+ */
+ search::index::FieldLengthInfo get_field_length_info(const vespalib::string& field_name) const override;
};
} // namespace searchcorespi
diff --git a/searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.cpp b/searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.cpp
index 668eeba6463..acde26ad554 100644
--- a/searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.cpp
+++ b/searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.cpp
@@ -124,6 +124,13 @@ public:
}
/**
+ * Implements IFieldLengthInspector
+ */
+ search::index::FieldLengthInfo get_field_length_info(const vespalib::string& field_name) const override {
+ return _index->get_field_length_info(field_name);
+ }
+
+ /**
* Implements IDiskIndex
*/
const vespalib::string &getIndexDir() const override { return _index->getIndexDir(); }
diff --git a/searchcorespi/src/vespa/searchcorespi/index/indexsearchable.h b/searchcorespi/src/vespa/searchcorespi/index/indexsearchable.h
index 03b7f91e47a..96db89b3e61 100644
--- a/searchcorespi/src/vespa/searchcorespi/index/indexsearchable.h
+++ b/searchcorespi/src/vespa/searchcorespi/index/indexsearchable.h
@@ -4,6 +4,7 @@
#include <vespa/searchcommon/attribute/iattributecontext.h>
#include <vespa/searchlib/common/serialnum.h>
+#include <vespa/searchlib/index/i_field_length_inspector.h>
#include <vespa/searchlib/query/tree/node.h>
#include <vespa/searchlib/queryeval/blueprint.h>
#include <vespa/searchlib/queryeval/field_spec.h>
@@ -26,7 +27,8 @@ class IndexSearchableVisitor;
* that let the components access a per query attribute context that expose
* attribute vectors that can be utilized during query evaluation.
**/
-class IndexSearchable : public search::queryeval::Searchable {
+class IndexSearchable : public search::queryeval::Searchable,
+ public search::index::IFieldLengthInspector {
protected:
using IRequestContext = search::queryeval::IRequestContext;
using FieldSpec = search::queryeval::FieldSpec;
diff --git a/searchcorespi/src/vespa/searchcorespi/index/warmupindexcollection.cpp b/searchcorespi/src/vespa/searchcorespi/index/warmupindexcollection.cpp
index 75412dcf8e9..911ff5f9eba 100644
--- a/searchcorespi/src/vespa/searchcorespi/index/warmupindexcollection.cpp
+++ b/searchcorespi/src/vespa/searchcorespi/index/warmupindexcollection.cpp
@@ -12,16 +12,17 @@ LOG_SETUP(".searchcorespi.index.warmupindexcollection");
namespace searchcorespi {
+using fastos::ClockSystem;
+using fastos::TimeStamp;
+using index::IDiskIndex;
+using search::fef::MatchDataLayout;
+using search::index::FieldLengthInfo;
using search::query::StringBase;
using search::queryeval::Blueprint;
-using search::fef::MatchDataLayout;
-using search::queryeval::SearchIterator;
using search::queryeval::ISourceSelector;
-using vespalib::makeTask;
+using search::queryeval::SearchIterator;
using vespalib::makeClosure;
-using index::IDiskIndex;
-using fastos::TimeStamp;
-using fastos::ClockSystem;
+using vespalib::makeTask;
using TermMap = vespalib::hash_set<vespalib::string>;
class FieldTermMap : public vespalib::hash_map<uint32_t, TermMap>
@@ -196,6 +197,11 @@ WarmupIndexCollection::accept(IndexSearchableVisitor &visitor) const
_next->accept(visitor);
}
+FieldLengthInfo
+WarmupIndexCollection::get_field_length_info(const vespalib::string& field_name) const
+{
+ return _next->get_field_length_info(field_name);
+}
void
WarmupIndexCollection::append(uint32_t id, const IndexSearchable::SP &source)
diff --git a/searchcorespi/src/vespa/searchcorespi/index/warmupindexcollection.h b/searchcorespi/src/vespa/searchcorespi/index/warmupindexcollection.h
index f6d6bc89fc4..229d1a7c31d 100644
--- a/searchcorespi/src/vespa/searchcorespi/index/warmupindexcollection.h
+++ b/searchcorespi/src/vespa/searchcorespi/index/warmupindexcollection.h
@@ -52,6 +52,9 @@ public:
search::SerialNum getSerialNum() const override;
void accept(IndexSearchableVisitor &visitor) const override;
+ // Implements IFieldLengthInspector
+ search::index::FieldLengthInfo get_field_length_info(const vespalib::string& field_name) const override;
+
// Implements ISearchableIndexCollection
void append(uint32_t id, const IndexSearchable::SP &source) override;
void replace(uint32_t id, const IndexSearchable::SP &source) override;