summaryrefslogtreecommitdiffstats
path: root/vsm
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@oath.com>2018-06-04 20:12:14 +0200
committerHenning Baldersheim <balder@oath.com>2018-06-05 15:46:55 +0200
commitd3ed38df6ae6dbdb0143fd20e8dd546da0c60bf3 (patch)
tree3abf23973b1d599616aee070985ce0aa64663d9d /vsm
parent257b508881cc74d0bbce675a4f07973b3196581f (diff)
Aggregate elementId
Diffstat (limited to 'vsm')
-rw-r--r--vsm/src/vespa/vsm/searcher/fieldsearcher.cpp6
-rw-r--r--vsm/src/vespa/vsm/searcher/fieldsearcher.h4
2 files changed, 6 insertions, 4 deletions
diff --git a/vsm/src/vespa/vsm/searcher/fieldsearcher.cpp b/vsm/src/vespa/vsm/searcher/fieldsearcher.cpp
index 31f53fee300..78531f41cf8 100644
--- a/vsm/src/vespa/vsm/searcher/fieldsearcher.cpp
+++ b/vsm/src/vespa/vsm/searcher/fieldsearcher.cpp
@@ -73,6 +73,7 @@ FieldSearcher::FieldSearcher(const FieldIdT & fId, bool defaultPrefix) :
_field(fId),
_matchType(defaultPrefix ? PREFIX : REGULAR),
_maxFieldLength(0x100000),
+ _currentElementId(0),
_currentElementWeight(1),
_pureUsAsciiCount(0),
_pureUsAsciiFieldCount(0),
@@ -85,9 +86,7 @@ FieldSearcher::FieldSearcher(const FieldIdT & fId, bool defaultPrefix) :
zeroStat();
}
-FieldSearcher::~FieldSearcher()
-{
-}
+FieldSearcher::~FieldSearcher() = default;
bool FieldSearcher::search(const StorageDocument & doc)
{
@@ -275,6 +274,7 @@ FieldSearcher::IteratorHandler::onPrimitive(uint32_t, const Content & c)
{
LOG(spam, "onPrimitive: field value '%s'", c.getValue().toString().c_str());
_searcher.setCurrentWeight(c.getWeight());
+ _searcher.setCurrentElementId(getArrayIndex());
_searcher.onValue(c.getValue());
}
diff --git a/vsm/src/vespa/vsm/searcher/fieldsearcher.h b/vsm/src/vespa/vsm/searcher/fieldsearcher.h
index 236382be5f9..2bf976de017 100644
--- a/vsm/src/vespa/vsm/searcher/fieldsearcher.h
+++ b/vsm/src/vespa/vsm/searcher/fieldsearcher.h
@@ -95,11 +95,13 @@ private:
void prepareFieldId();
void setCurrentWeight(int32_t weight) { _currentElementWeight = weight; }
+ void setCurrentElementId(int32_t weight) { _currentElementId = weight; }
bool onSearch(const StorageDocument & doc);
virtual void onValue(const document::FieldValue & fv) = 0;
FieldIdT _field;
MatchType _matchType;
unsigned _maxFieldLength;
+ uint32_t _currentElementId;
int32_t _currentElementWeight; // Contains the weight of the current item being evaluated.
/// Number of bytes in blocks containing pure us-ascii
unsigned _pureUsAsciiCount;
@@ -124,7 +126,7 @@ protected:
* For each call to onValue() a batch of words are processed, and the position is local to this batch.
**/
void addHit(search::QueryTerm & qt, uint32_t pos) const {
- qt.add(_words + pos, field(), getCurrentWeight());
+ qt.add(_words + pos, field(), _currentElementId, getCurrentWeight());
}
public:
static search::byte _foldLowCase[256];