aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeir Storli <geirst@yahoo-inc.com>2017-03-16 09:43:42 +0000
committerGeir Storli <geirst@yahoo-inc.com>2017-03-16 09:43:42 +0000
commite0c9d6e43c1d4b62a1eb8fbb73b9e9c87938e85f (patch)
treeb11ae0b270a69ca9e1d035606f01118373298ab5
parent4f143fabbfc927726a6284712ae00f956b7a0319 (diff)
Simplify ISearchContext.
-rw-r--r--searchcommon/src/vespa/searchcommon/attribute/i_search_context.h19
-rw-r--r--searchlib/src/vespa/searchlib/attribute/attribute_blueprint_factory.cpp2
-rw-r--r--searchlib/src/vespa/searchlib/attribute/attributevector.h61
3 files changed, 23 insertions, 59 deletions
diff --git a/searchcommon/src/vespa/searchcommon/attribute/i_search_context.h b/searchcommon/src/vespa/searchcommon/attribute/i_search_context.h
index eb5ba68d6ee..936545210f4 100644
--- a/searchcommon/src/vespa/searchcommon/attribute/i_search_context.h
+++ b/searchcommon/src/vespa/searchcommon/attribute/i_search_context.h
@@ -3,6 +3,7 @@
#pragma once
#include <vespa/searchcommon/common/range.h>
+#include <vespa/vespalib/stllike/string.h>
namespace search {
@@ -17,8 +18,6 @@ class QueryTermBase;
namespace attribute {
-class IAttributeVector;
-
class ISearchContext {
public:
using UP = std::unique_ptr<ISearchContext>;
@@ -40,20 +39,6 @@ public:
virtual std::unique_ptr<queryeval::SearchIterator>
createIterator(fef::TermFieldMatchData *matchData, bool strict) = 0;
- /**
- * Creates an attribute search iterator associated with this
- * search context. Postings lists are not used.
- *
- * @return attribute search iterator
- *
- * @param matchData the attribute match data used when
- * unpacking data for a hit
- *
- * @param strict whether the iterator should be strict or not
- **/
- virtual std::unique_ptr<queryeval::SearchIterator>
- createFilterIterator(fef::TermFieldMatchData *matchData, bool strict) = 0;
-
/*
* Create temporary posting lists.
* Should be called before createIterator() is called.
@@ -63,7 +48,7 @@ public:
virtual bool valid() const = 0;
virtual Int64Range getAsIntegerTerm() const = 0;
virtual const QueryTermBase &queryTerm() const = 0;
- virtual const IAttributeVector &attribute() const = 0;
+ virtual const vespalib::string &attributeName() const = 0;
};
diff --git a/searchlib/src/vespa/searchlib/attribute/attribute_blueprint_factory.cpp b/searchlib/src/vespa/searchlib/attribute/attribute_blueprint_factory.cpp
index 333af480eba..c4e9d9701ae 100644
--- a/searchlib/src/vespa/searchlib/attribute/attribute_blueprint_factory.cpp
+++ b/searchlib/src/vespa/searchlib/attribute/attribute_blueprint_factory.cpp
@@ -142,7 +142,7 @@ void
AttributeFieldBlueprint::visitMembers(vespalib::ObjectVisitor &visitor) const
{
search::queryeval::LeafBlueprint::visitMembers(visitor);
- visit(visitor, "attribute", _search_context->attribute().getName());
+ visit(visitor, "attribute", _search_context->attributeName());
}
//-----------------------------------------------------------------------------
diff --git a/searchlib/src/vespa/searchlib/attribute/attributevector.h b/searchlib/src/vespa/searchlib/attribute/attributevector.h
index 08d954b974f..64a9cb0adf8 100644
--- a/searchlib/src/vespa/searchlib/attribute/attributevector.h
+++ b/searchlib/src/vespa/searchlib/attribute/attributevector.h
@@ -524,52 +524,25 @@ public:
typedef std::unique_ptr<SearchContext> UP;
~SearchContext();
- unsigned int approximateHits() const override;
- /**
- * Creates an attribute search iterator associated with this
- * search context.
- *
- * @return attribute search iterator
- *
- * @param matchData the attribute match data used when
- * unpacking data for a hit
- *
- * @param strict whether the iterator should be strict or not
- *
- * @param useBitVector whether bitvectors should be used when available
- **/
- queryeval::SearchIterator::UP
- createIterator(fef::TermFieldMatchData *matchData, bool strict) override;
+ // Implements attribute::ISearchContext
+ virtual unsigned int approximateHits() const override;
+ virtual queryeval::SearchIterator::UP createIterator(fef::TermFieldMatchData *matchData, bool strict) override;
+ virtual void fetchPostings(bool strict) override;
+ virtual bool valid() const override { return false; }
+ virtual Int64Range getAsIntegerTerm() const override { return Int64Range(); }
+ virtual const QueryTermBase &queryTerm() const override {
+ return *static_cast<const QueryTermBase *>(NULL);
+ }
+ virtual const vespalib::string &attributeName() const override {
+ return _attr.getName();
+ }
+
+
- /**
- * Creates an attribute search iterator associated with this
- * search context. Postings lists are not used.
- *
- * @return attribute search iterator
- *
- * @param matchData the attribute match data used when
- * unpacking data for a hit
- *
- * @param strict whether the iterator should be strict or not
- **/
- queryeval::SearchIterator::UP
- createFilterIterator(fef::TermFieldMatchData *matchData, bool strict) override;
-
- /*
- * Create temporary posting lists. Should be called before
- * createIterator is called.
- */
- virtual void fetchPostings(bool strict);
bool cmp(DocId docId, int32_t &weight) const { return onCmp(docId, weight); }
bool cmp(DocId docId) const { return onCmp(docId); }
const AttributeVector & attribute() const { return _attr; }
- virtual bool valid() const { return false; }
- virtual Int64Range getAsIntegerTerm() const { return Int64Range(); }
-
- virtual const QueryTermBase & queryTerm() const {
- return *static_cast<const QueryTermBase *>(NULL);
- }
protected:
SearchContext(const AttributeVector &attr);
@@ -581,6 +554,12 @@ public:
protected:
attribute::IPostingListSearchContext *_plsc;
+ /**
+ * Creates an attribute search iterator associated with this
+ * search context. Postings lists are not used.
+ **/
+ virtual queryeval::SearchIterator::UP createFilterIterator(fef::TermFieldMatchData *matchData, bool strict);
+
bool getIsFilter() const { return _attr.getConfig().getIsFilter(); }
};