summaryrefslogtreecommitdiffstats
path: root/searchcommon
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@oath.com>2018-08-27 10:50:31 +0200
committerHenning Baldersheim <balder@oath.com>2018-08-27 10:50:31 +0200
commit406bb7fca1f90f0ab97f6f6b4752ca3e235c08ce (patch)
treecadff66271030181354170ec0a63667e4ad20bd6 /searchcommon
parent4b2f2f0195b4b3c4483d5539b8f50cdd83eb5bf6 (diff)
Only allow query time modification of attributes marked mutable.
Diffstat (limited to 'searchcommon')
-rw-r--r--searchcommon/src/vespa/searchcommon/attribute/config.cpp21
-rw-r--r--searchcommon/src/vespa/searchcommon/attribute/config.h43
2 files changed, 36 insertions, 28 deletions
diff --git a/searchcommon/src/vespa/searchcommon/attribute/config.cpp b/searchcommon/src/vespa/searchcommon/attribute/config.cpp
index 221924a1689..ac3d2327157 100644
--- a/searchcommon/src/vespa/searchcommon/attribute/config.cpp
+++ b/searchcommon/src/vespa/searchcommon/attribute/config.cpp
@@ -13,6 +13,7 @@ Config::Config() :
_enableOnlyBitVector(false),
_isFilter(false),
_fastAccess(false),
+ _mutable(false),
_growStrategy(),
_compactionStrategy(),
_predicateParams(),
@@ -29,6 +30,7 @@ Config::Config(BasicType bt, CollectionType ct, bool fastSearch_, bool huge_)
_enableOnlyBitVector(false),
_isFilter(false),
_fastAccess(false),
+ _mutable(false),
_growStrategy(),
_compactionStrategy(),
_predicateParams(),
@@ -40,4 +42,23 @@ Config::Config(const Config &) = default;
Config & Config::operator = (const Config &) = default;
Config::~Config() = default;
+bool
+Config::operator==(const Config &b) const
+{
+ return _basicType == b._basicType &&
+ _type == b._type &&
+ _huge == b._huge &&
+ _fastSearch == b._fastSearch &&
+ _enableBitVectors == b._enableBitVectors &&
+ _enableOnlyBitVector == b._enableOnlyBitVector &&
+ _isFilter == b._isFilter &&
+ _fastAccess == b._fastAccess &&
+ _mutable == b._mutable &&
+ _growStrategy == b._growStrategy &&
+ _compactionStrategy == b._compactionStrategy &&
+ _predicateParams == b._predicateParams &&
+ (_basicType.type() != BasicType::Type::TENSOR ||
+ _tensorType == b._tensorType);
+}
+
}
diff --git a/searchcommon/src/vespa/searchcommon/attribute/config.h b/searchcommon/src/vespa/searchcommon/attribute/config.h
index 683b45b59e5..fe464736a6b 100644
--- a/searchcommon/src/vespa/searchcommon/attribute/config.h
+++ b/searchcommon/src/vespa/searchcommon/attribute/config.h
@@ -41,6 +41,7 @@ public:
bool getEnableOnlyBitVector() const { return _enableOnlyBitVector; }
bool getIsFilter() const { return _isFilter; }
+ bool isMutable() const { return _mutable; }
/**
* Check if this attribute should be fast accessible at all times.
@@ -50,19 +51,21 @@ public:
const GrowStrategy & getGrowStrategy() const { return _growStrategy; }
const CompactionStrategy &getCompactionStrategy() const { return _compactionStrategy; }
- void setHuge(bool v) { _huge = v; }
- void setFastSearch(bool v) { _fastSearch = v; }
- void setPredicateParams(const PredicateParams &v) { _predicateParams = v; }
- void setTensorType(const vespalib::eval::ValueType &tensorType_in) {
+ Config & setHuge(bool v) { _huge = v; return *this;}
+ Config & setFastSearch(bool v) { _fastSearch = v; return *this; }
+ Config & setPredicateParams(const PredicateParams &v) { _predicateParams = v; return *this; }
+ Config & setTensorType(const vespalib::eval::ValueType &tensorType_in) {
_tensorType = tensorType_in;
+ return *this;
}
/**
* Enable attribute posting list to consist of a bitvector in
* addition to (or instead of) a btree.
*/
- void setEnableBitVectors(bool enableBitVectors) {
+ Config & setEnableBitVectors(bool enableBitVectors) {
_enableBitVectors = enableBitVectors;
+ return *this;
}
/**
@@ -71,39 +74,22 @@ public:
* document frequency goes down, since recreated btree representation
* will then have lost weight information.
*/
- void setEnableOnlyBitVector(bool enableOnlyBitVector) {
+ Config & setEnableOnlyBitVector(bool enableOnlyBitVector) {
_enableOnlyBitVector = enableOnlyBitVector;
+ return *this;
}
/**
* Hide weight information when searching in attributes.
*/
- void setIsFilter(bool isFilter) {
- _isFilter = isFilter;
- }
+ Config & setIsFilter(bool isFilter) { _isFilter = isFilter; return *this; }
- void setFastAccess(bool v) { _fastAccess = v; }
+ Config & setMutable(bool isMutable) { _mutable = isMutable; return *this; }
+ Config & setFastAccess(bool v) { _fastAccess = v; return *this; }
Config & setGrowStrategy(const GrowStrategy &gs) { _growStrategy = gs; return *this; }
Config &setCompactionStrategy(const CompactionStrategy &compactionStrategy) { _compactionStrategy = compactionStrategy; return *this; }
bool operator!=(const Config &b) const { return !(operator==(b)); }
-
- bool
- operator==(const Config &b) const
- {
- return _basicType == b._basicType &&
- _type == b._type &&
- _huge == b._huge &&
- _fastSearch == b._fastSearch &&
- _enableBitVectors == b._enableBitVectors &&
- _enableOnlyBitVector == b._enableOnlyBitVector &&
- _isFilter == b._isFilter &&
- _fastAccess == b._fastAccess &&
- _growStrategy == b._growStrategy &&
- _compactionStrategy == b._compactionStrategy &&
- _predicateParams == b._predicateParams &&
- (_basicType.type() != BasicType::Type::TENSOR ||
- _tensorType == b._tensorType);
- }
+ bool operator==(const Config &b) const;
private:
BasicType _basicType;
@@ -114,6 +100,7 @@ private:
bool _enableOnlyBitVector;
bool _isFilter;
bool _fastAccess;
+ bool _mutable;
GrowStrategy _growStrategy;
CompactionStrategy _compactionStrategy;
PredicateParams _predicateParams;