summaryrefslogtreecommitdiffstats
path: root/searchlib
diff options
context:
space:
mode:
authorTor Egge <Tor.Egge@broadpark.no>2019-05-13 15:42:19 +0200
committerGitHub <noreply@github.com>2019-05-13 15:42:19 +0200
commit486e8338539bb2c3b64237ec6c836d467510df5d (patch)
treed284a7fdd6fb9c50d93db6b8981b33d322fe2339 /searchlib
parent4bbc51d46547fe47d6adefb64c55cfabc324b6cb (diff)
parent07bdff6484972e6417e68caedd5cd5d6becf2333 (diff)
Merge pull request #9385 from vespa-engine/geirst/extend-term-field-match-data
Add num occs and field length used when unpacking "cheap" features.
Diffstat (limited to 'searchlib')
-rw-r--r--searchlib/src/vespa/searchlib/fef/termfieldmatchdata.cpp10
-rw-r--r--searchlib/src/vespa/searchlib/fef/termfieldmatchdata.h14
2 files changed, 22 insertions, 2 deletions
diff --git a/searchlib/src/vespa/searchlib/fef/termfieldmatchdata.cpp b/searchlib/src/vespa/searchlib/fef/termfieldmatchdata.cpp
index 69baa772639..1471021ddab 100644
--- a/searchlib/src/vespa/searchlib/fef/termfieldmatchdata.cpp
+++ b/searchlib/src/vespa/searchlib/fef/termfieldmatchdata.cpp
@@ -9,7 +9,9 @@ namespace search::fef {
TermFieldMatchData::TermFieldMatchData() :
_docId(invalidId()),
_fieldId(FIELDID_MASK),
- _sz(0)
+ _sz(0),
+ _numOccs(0),
+ _fieldLength(0)
{
memset(&_data, 0, sizeof(_data));
}
@@ -17,7 +19,9 @@ TermFieldMatchData::TermFieldMatchData() :
TermFieldMatchData::TermFieldMatchData(const TermFieldMatchData & rhs) :
_docId(rhs._docId),
_fieldId(rhs._fieldId),
- _sz(0)
+ _sz(0),
+ _numOccs(0),
+ _fieldLength(0)
{
memset(&_data, 0, sizeof(_data));
if (isRawScore()) {
@@ -87,6 +91,8 @@ TermFieldMatchData::swap(TermFieldMatchData &rhs)
sswap(&_docId, &rhs._docId);
sswap(&_fieldId, &rhs._fieldId);
sswap(&_sz, &rhs._sz);
+ sswap(&_numOccs, &rhs._numOccs);
+ sswap(&_fieldLength, &rhs._fieldLength);
char tmp[sizeof(_data)];
memcpy(tmp, &rhs._data, sizeof(_data));
memcpy(&rhs._data, &_data, sizeof(_data));
diff --git a/searchlib/src/vespa/searchlib/fef/termfieldmatchdata.h b/searchlib/src/vespa/searchlib/fef/termfieldmatchdata.h
index 01851a7c2fb..b319e49aedf 100644
--- a/searchlib/src/vespa/searchlib/fef/termfieldmatchdata.h
+++ b/searchlib/src/vespa/searchlib/fef/termfieldmatchdata.h
@@ -55,6 +55,12 @@ private:
// 3 upper bits used to tell if it is use for RawScore, SinglePos or multiPos.
uint16_t _fieldId;
uint16_t _sz;
+
+ // Number of occurrences and field length used when unpacking "cheap" features.
+ // This can exist in addition to full position features.
+ uint16_t _numOccs;
+ uint16_t _fieldLength;
+
Features _data;
friend class ::MatchDataHeapTest;
@@ -120,6 +126,8 @@ public:
TermFieldMatchData &reset(uint32_t docId) {
_docId = docId;
_sz = 0;
+ _numOccs = 0;
+ _fieldLength = 0;
if (isRawScore()) {
_data._rawScore = 0.0;
} else if (isMultiPos()) {
@@ -236,6 +244,12 @@ public:
return FieldPositionsIterator(len != 0 ? len : FieldPositionsIterator::UNKNOWN_LENGTH, begin(), end());
}
+ uint16_t getNumOccs() const { return _numOccs; }
+ uint16_t getFieldLength() const { return _fieldLength; }
+
+ void setNumOccs(uint16_t value) { _numOccs = value; }
+ void setFieldLength(uint16_t value) { _fieldLength = value; }
+
/**
* This indicates if this instance is actually used for ranking or not.
* @return true if it is not needed.