aboutsummaryrefslogtreecommitdiffstats
path: root/searchlib/src
diff options
context:
space:
mode:
authorTor Egge <Tor.Egge@verizonmedia.com>2019-03-21 12:40:46 +0100
committerTor Egge <Tor.Egge@verizonmedia.com>2019-03-21 12:40:46 +0100
commitb1ce7340bd6621bc73ccff70b78d2b064460439a (patch)
treeffa154600204805a1a891ca19d56e412ddcf4d91 /searchlib/src
parent573e322c1ac89e4c8b9f5a7f9e9784c23db2a2f0 (diff)
Test compact lid space for predicate attribute.
Diffstat (limited to 'searchlib/src')
-rw-r--r--searchlib/src/tests/attribute/attribute_test.cpp20
-rw-r--r--searchlib/src/vespa/searchlib/attribute/predicate_attribute.cpp1
2 files changed, 21 insertions, 0 deletions
diff --git a/searchlib/src/tests/attribute/attribute_test.cpp b/searchlib/src/tests/attribute/attribute_test.cpp
index 4e38bd45f9d..537fa07bada 100644
--- a/searchlib/src/tests/attribute/attribute_test.cpp
+++ b/searchlib/src/tests/attribute/attribute_test.cpp
@@ -8,6 +8,7 @@
#include <vespa/searchlib/attribute/attributeguard.h>
#include <vespa/searchlib/attribute/attributefactory.h>
#include <vespa/searchlib/attribute/attributememorysavetarget.h>
+#include <vespa/searchlib/attribute/predicate_attribute.h>
#include <vespa/searchlib/attribute/singlenumericattribute.h>
#include <vespa/searchlib/attribute/multinumericattribute.h>
#include <vespa/searchlib/attribute/singlestringattribute.h>
@@ -223,6 +224,9 @@ private:
testCompactLidSpace(const Config &config);
void
+ testCompactLidSpaceForPredicateAttribute(const Config &config);
+
+ void
testCompactLidSpace(const Config &config);
void testCompactLidSpace();
@@ -2005,6 +2009,18 @@ AttributeTest::testCompactLidSpace(const Config &config)
}
void
+AttributeTest::testCompactLidSpaceForPredicateAttribute(const Config &config)
+{
+ vespalib::string name = clsDir + "/predicate-single";
+ LOG(info, "testCompactLidSpace(%s)", name.c_str());
+ AttributePtr attr = AttributeFactory::createAttribute(name, config);
+ attr->addDocs(10);
+ attr->compactLidSpace(10);
+ attr->clearDoc(10);
+ attr->compactLidSpace(11);
+}
+
+void
AttributeTest::testCompactLidSpace(const Config &config)
{
switch (config.basicType().type()) {
@@ -2036,6 +2052,9 @@ AttributeTest::testCompactLidSpace(const Config &config)
testCompactLidSpace<StringAttribute, string>(config);
}
break;
+ case BasicType::PREDICATE:
+ testCompactLidSpaceForPredicateAttribute(config);
+ break;
default:
LOG_ABORT("should not be reached");
}
@@ -2068,6 +2087,7 @@ AttributeTest::testCompactLidSpace()
TEST_DO(testCompactLidSpace(Config(BasicType::STRING, CollectionType::SINGLE)));
TEST_DO(testCompactLidSpace(Config(BasicType::STRING, CollectionType::ARRAY)));
TEST_DO(testCompactLidSpace(Config(BasicType::STRING, CollectionType::WSET)));
+ TEST_DO(testCompactLidSpace(Config(BasicType::PREDICATE, CollectionType::SINGLE)));
}
template <typename AttributeType>
diff --git a/searchlib/src/vespa/searchlib/attribute/predicate_attribute.cpp b/searchlib/src/vespa/searchlib/attribute/predicate_attribute.cpp
index cc43ce88da2..d3c2512b2fc 100644
--- a/searchlib/src/vespa/searchlib/attribute/predicate_attribute.cpp
+++ b/searchlib/src/vespa/searchlib/attribute/predicate_attribute.cpp
@@ -240,6 +240,7 @@ PredicateAttribute::addDoc(DocId &doc_id)
uint32_t
PredicateAttribute::clearDoc(DocId doc_id)
{
+ updateUncommittedDocIdLimit(doc_id);
_index->removeDocument(doc_id);
_min_feature[doc_id] = MIN_FEATURE_FILL;
_interval_range_vector[doc_id] = 0;