summaryrefslogtreecommitdiffstats
path: root/searchcommon
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@oath.com>2018-05-22 21:29:12 +0200
committerHenning Baldersheim <balder@oath.com>2018-05-23 23:21:04 +0200
commit69aae49a30dc657dfa5a603701ffe4ad231ea92f (patch)
tree9f2e743a208b1d2751b350f9d7ee5e8e274cb2de /searchcommon
parentff2138aa963c5f7147779057465d97c3d22a7028 (diff)
Refactored to allow iteration over matching elements.
Diffstat (limited to 'searchcommon')
-rw-r--r--searchcommon/src/vespa/searchcommon/attribute/i_search_context.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/searchcommon/src/vespa/searchcommon/attribute/i_search_context.h b/searchcommon/src/vespa/searchcommon/attribute/i_search_context.h
index 4be1f00dcbc..3eede13c42d 100644
--- a/searchcommon/src/vespa/searchcommon/attribute/i_search_context.h
+++ b/searchcommon/src/vespa/searchcommon/attribute/i_search_context.h
@@ -24,8 +24,8 @@ public:
using DocId = uint32_t;
private:
- virtual bool onCmp(DocId docId, int32_t &weight) const = 0;
- virtual bool onCmp(DocId docId) const = 0;
+ virtual int32_t onCmp(DocId docId, int32_t elementId, int32_t &weight) const = 0;
+ virtual int32_t onCmp(DocId docId, int32_t elementId) const = 0;
public:
virtual ~ISearchContext() {}
@@ -57,8 +57,10 @@ public:
virtual const QueryTermBase &queryTerm() const = 0;
virtual const vespalib::string &attributeName() const = 0;
- bool cmp(DocId docId, int32_t &weight) const { return onCmp(docId, weight); }
- bool cmp(DocId docId) const { return onCmp(docId); }
+ int32_t find(DocId docId, int32_t elementId, int32_t &weight) const { return onCmp(docId, elementId, weight); }
+ int32_t find(DocId docId, int32_t elementId) const { return onCmp(docId, elementId); }
+ bool matches(DocId docId, int32_t &weight) const { return find(docId, 0, weight) >= 0; }
+ bool matches(DocId doc) const { return find(doc, 0) >= 0; }
};