diff options
author | Geir Storli <geirst@yahooinc.com> | 2021-12-20 12:16:52 +0000 |
---|---|---|
committer | Geir Storli <geirst@yahooinc.com> | 2021-12-20 12:16:52 +0000 |
commit | 5a6fb96425ea47f9ba2c4a6e9294a53fc2fd3cb1 (patch) | |
tree | a3c4f23eddce4ebc892a174d16dd617be8ec2d14 /searchlib | |
parent | a744d811f50fb521c89810a705597b059348543f (diff) |
Rename change data functions to reflect that an entry ref can be cached.
Diffstat (limited to 'searchlib')
6 files changed, 21 insertions, 21 deletions
diff --git a/searchlib/src/vespa/searchlib/attribute/changevector.h b/searchlib/src/vespa/searchlib/attribute/changevector.h index f1fb58eb9d0..014c218bc76 100644 --- a/searchlib/src/vespa/searchlib/attribute/changevector.h +++ b/searchlib/src/vespa/searchlib/attribute/changevector.h @@ -25,32 +25,32 @@ struct ChangeBase { DIV, CLEARDOC }; - enum {UNSET_ENUM = 0xffffffffu}; + enum {UNSET_ENTRY_REF = 0xffffffffu}; ChangeBase() : _type(NOOP), _doc(0), _weight(1), - _enumScratchPad(UNSET_ENUM) + _cached_entry_ref(UNSET_ENTRY_REF) { } ChangeBase(Type type, uint32_t d, int32_t w = 1) : _type(type), _doc(d), _weight(w), - _enumScratchPad(UNSET_ENUM) + _cached_entry_ref(UNSET_ENTRY_REF) { } int cmp(const ChangeBase &b) const { int diff(_doc - b._doc); return diff; } bool operator <(const ChangeBase & b) const { return cmp(b) < 0; } - uint32_t getEnum() const { return _enumScratchPad; } - void setEnum(uint32_t value) const { _enumScratchPad = value; } - bool isEnumValid() const { return _enumScratchPad != UNSET_ENUM; } + uint32_t get_entry_ref() const { return _cached_entry_ref; } + void set_entry_ref(uint32_t entry_ref) const { _cached_entry_ref = entry_ref; } + bool has_entry_ref() const { return _cached_entry_ref != UNSET_ENTRY_REF; } Type _type; uint32_t _doc; int32_t _weight; - mutable uint32_t _enumScratchPad; + mutable uint32_t _cached_entry_ref; }; template <typename T> diff --git a/searchlib/src/vespa/searchlib/attribute/multienumattribute.hpp b/searchlib/src/vespa/searchlib/attribute/multienumattribute.hpp index 251bbd7c8a7..7df30b895d2 100644 --- a/searchlib/src/vespa/searchlib/attribute/multienumattribute.hpp +++ b/searchlib/src/vespa/searchlib/attribute/multienumattribute.hpp @@ -25,10 +25,10 @@ template <typename B, typename M> bool MultiValueEnumAttribute<B, M>::extractChangeData(const Change & c, EnumIndex & idx) { - if ( ! c.isEnumValid() ) { + if ( ! c.has_entry_ref() ) { return this->_enumStore.find_index(c._data.raw(), idx); } - idx = EnumIndex(vespalib::datastore::EntryRef(c.getEnum())); + idx = EnumIndex(vespalib::datastore::EntryRef(c.get_entry_ref())); return true; } @@ -42,9 +42,9 @@ MultiValueEnumAttribute<B, M>::considerAttributeChange(const Change & c, EnumSto { EnumIndex idx; if (!this->_enumStore.find_index(c._data.raw(), idx)) { - c.setEnum(inserter.insert(c._data.raw()).ref()); + c.set_entry_ref(inserter.insert(c._data.raw()).ref()); } else { - c.setEnum(idx.ref()); + c.set_entry_ref(idx.ref()); } } } diff --git a/searchlib/src/vespa/searchlib/attribute/singleenumattribute.hpp b/searchlib/src/vespa/searchlib/attribute/singleenumattribute.hpp index dde853cbc90..dc6db1d5a82 100644 --- a/searchlib/src/vespa/searchlib/attribute/singleenumattribute.hpp +++ b/searchlib/src/vespa/searchlib/attribute/singleenumattribute.hpp @@ -140,9 +140,9 @@ SingleValueEnumAttribute<B>::considerUpdateAttributeChange(const Change & c, Enu { EnumIndex idx; if (!this->_enumStore.find_index(c._data.raw(), idx)) { - c.setEnum(inserter.insert(c._data.raw()).ref()); + c.set_entry_ref(inserter.insert(c._data.raw()).ref()); } else { - c.setEnum(idx.ref()); + c.set_entry_ref(idx.ref()); } considerUpdateAttributeChange(c); // for numeric } @@ -168,8 +168,8 @@ SingleValueEnumAttribute<B>::applyUpdateValueChange(const Change& c, EnumStoreBa { EnumIndex oldIdx = _enumIndices[c._doc]; EnumIndex newIdx; - if (c.isEnumValid()) { - newIdx = EnumIndex(vespalib::datastore::EntryRef(c.getEnum())); + if (c.has_entry_ref()) { + newIdx = EnumIndex(vespalib::datastore::EntryRef(c.get_entry_ref())); } else { this->_enumStore.find_index(c._data.raw(), newIdx); } diff --git a/searchlib/src/vespa/searchlib/attribute/singlenumericenumattribute.hpp b/searchlib/src/vespa/searchlib/attribute/singlenumericenumattribute.hpp index d6622f7c880..c6b720ba14e 100644 --- a/searchlib/src/vespa/searchlib/attribute/singlenumericenumattribute.hpp +++ b/searchlib/src/vespa/searchlib/attribute/singlenumericenumattribute.hpp @@ -38,9 +38,9 @@ SingleValueNumericEnumAttribute<B>::considerArithmeticAttributeChange(const Chan EnumIndex idx; if (!this->_enumStore.find_index(newValue, idx)) { - c.setEnum(inserter.insert(newValue).ref()); + c.set_entry_ref(inserter.insert(newValue).ref()); } else { - c.setEnum(idx.ref()); + c.set_entry_ref(idx.ref()); } _currDocValues[c._doc] = newValue; diff --git a/searchlib/src/vespa/searchlib/attribute/singlenumericpostattribute.hpp b/searchlib/src/vespa/searchlib/attribute/singlenumericpostattribute.hpp index 1083d0f4cb8..4d4e4619d51 100644 --- a/searchlib/src/vespa/searchlib/attribute/singlenumericpostattribute.hpp +++ b/searchlib/src/vespa/searchlib/attribute/singlenumericpostattribute.hpp @@ -47,8 +47,8 @@ SingleValueNumericPostingAttribute<B>::applyUpdateValueChange(const Change & c, std::map<DocId, EnumIndex> & currEnumIndices) { EnumIndex newIdx; - if (c.isEnumValid()) { - newIdx = EnumIndex(vespalib::datastore::EntryRef(c.getEnum())); + if (c.has_entry_ref()) { + newIdx = EnumIndex(vespalib::datastore::EntryRef(c.get_entry_ref())); } else { enumStore.find_index(c._data.raw(), newIdx); } diff --git a/searchlib/src/vespa/searchlib/attribute/singlestringpostattribute.hpp b/searchlib/src/vespa/searchlib/attribute/singlestringpostattribute.hpp index e77c59e915d..592ecb68b1e 100644 --- a/searchlib/src/vespa/searchlib/attribute/singlestringpostattribute.hpp +++ b/searchlib/src/vespa/searchlib/attribute/singlestringpostattribute.hpp @@ -45,8 +45,8 @@ SingleValueStringPostingAttributeT<B>::applyUpdateValueChange(const Change & c, std::map<DocId, EnumIndex> &currEnumIndices) { EnumIndex newIdx; - if (c.isEnumValid()) { - newIdx = EnumIndex(vespalib::datastore::EntryRef(c.getEnum())); + if (c.has_entry_ref()) { + newIdx = EnumIndex(vespalib::datastore::EntryRef(c.get_entry_ref())); } else { enumStore.find_index(c._data.raw(), newIdx); } |