summaryrefslogtreecommitdiffstats
path: root/searchcommon
diff options
context:
space:
mode:
authorGeir Storli <geirst@yahoo-inc.com>2017-03-15 14:51:21 +0000
committerGeir Storli <geirst@yahoo-inc.com>2017-03-15 14:51:21 +0000
commitac342e998ba02c42a7a22651986f1dfaa8131b54 (patch)
tree7e6758f36303721670647ae2508de8a4fec99d71 /searchcommon
parentf111ab07d4edc8a1640ed87b74162f6d3b99ad71 (diff)
Extend IAttributeVector API with function for creating a ISearchContext.
Diffstat (limited to 'searchcommon')
-rw-r--r--searchcommon/src/vespa/searchcommon/attribute/i_search_context.h6
-rw-r--r--searchcommon/src/vespa/searchcommon/attribute/iattributevector.h18
2 files changed, 23 insertions, 1 deletions
diff --git a/searchcommon/src/vespa/searchcommon/attribute/i_search_context.h b/searchcommon/src/vespa/searchcommon/attribute/i_search_context.h
index f5751135ef7..eb5ba68d6ee 100644
--- a/searchcommon/src/vespa/searchcommon/attribute/i_search_context.h
+++ b/searchcommon/src/vespa/searchcommon/attribute/i_search_context.h
@@ -17,8 +17,11 @@ class QueryTermBase;
namespace attribute {
+class IAttributeVector;
+
class ISearchContext {
public:
+ using UP = std::unique_ptr<ISearchContext>;
virtual ~ISearchContext() {}
virtual unsigned int approximateHits() const = 0;
@@ -59,7 +62,8 @@ public:
virtual bool valid() const = 0;
virtual Int64Range getAsIntegerTerm() const = 0;
- virtual const QueryTermBase & queryTerm() const = 0;
+ virtual const QueryTermBase &queryTerm() const = 0;
+ virtual const IAttributeVector &attribute() const = 0;
};
diff --git a/searchcommon/src/vespa/searchcommon/attribute/iattributevector.h b/searchcommon/src/vespa/searchcommon/attribute/iattributevector.h
index 8e17e697d0e..edc71591175 100644
--- a/searchcommon/src/vespa/searchcommon/attribute/iattributevector.h
+++ b/searchcommon/src/vespa/searchcommon/attribute/iattributevector.h
@@ -10,8 +10,14 @@
#include <vespa/searchcommon/attribute/basictype.h>
namespace search {
+
+class QueryTermSimple;
+
namespace attribute {
+class ISearchContext;
+class SearchContextParams;
+
/**
* This class is used to store a value and a weight.
* It is used when getting content from a weighted set attribute vector.
@@ -236,6 +242,18 @@ public:
**/
virtual bool findEnum(const char * value, EnumHandle & e) const = 0;
+
+ /**
+ * Creates a context for searching this attribute with the given term.
+ * The search context is used to create the actual search iterator.
+ *
+ * @param term the term to search for.
+ * @param params optional bitvector and diversity settings for the search.
+ * @return the search context.
+ **/
+ virtual std::unique_ptr<ISearchContext> createSearchContext(std::unique_ptr<QueryTermSimple> term,
+ const SearchContextParams &params) const = 0;
+
/**
* Returns the basic type of this attribute vector.
*