aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTor Egge <Tor.Egge@online.no>2023-07-11 12:29:58 +0200
committerGitHub <noreply@github.com>2023-07-11 12:29:58 +0200
commit62df45c284db9613764d9ca2b01825d9abb42812 (patch)
tree160dfe776942a5cf35bbba2fc9a7a3103368c80e
parent71a804496baaa27ae4d42922e6db95393c6dbd87 (diff)
Revert "- Enable use of optimized DirectWeightedAttribute for all integer att…"
-rw-r--r--searchlib/src/tests/attribute/bitvector/bitvector_test.cpp13
-rw-r--r--searchlib/src/tests/attribute/document_weight_iterator/document_weight_iterator_test.cpp3
-rw-r--r--searchlib/src/vespa/searchlib/attribute/multinumericpostattribute.hpp4
-rw-r--r--searchlib/src/vespa/searchlib/attribute/multistringpostattribute.hpp4
4 files changed, 14 insertions, 10 deletions
diff --git a/searchlib/src/tests/attribute/bitvector/bitvector_test.cpp b/searchlib/src/tests/attribute/bitvector/bitvector_test.cpp
index e0f4a99dfc9..5fa8889a01d 100644
--- a/searchlib/src/tests/attribute/bitvector/bitvector_test.cpp
+++ b/searchlib/src/tests/attribute/bitvector/bitvector_test.cpp
@@ -160,14 +160,14 @@ template <>
vespalib::string
BitVectorTest::getSearchStr<IntegerAttribute>()
{
- return "-42";
+ return "[-42;-42]";
}
template <>
vespalib::string
BitVectorTest::getSearchStr<FloatingPointAttribute>()
{
- return "-42.0";
+ return "[-42.0;-42.0]";
}
template <>
@@ -365,6 +365,7 @@ BitVectorTest::checkSearch(AttributePtr v,
bool weights,
bool checkStride)
{
+ (void) checkStride;
sb->initRange(1, v->getCommittedDocIdLimit());
sb->seek(1u);
uint32_t docId = sb->getDocId();
@@ -374,7 +375,7 @@ BitVectorTest::checkSearch(AttributePtr v,
while (docId != search::endDocId) {
lastDocId = docId;
++docFreq,
- ASSERT_TRUE(!checkStride || (docId % 5) == 2u);
+ assert(!checkStride || (docId % 5) == 2u);
sb->unpack(docId);
EXPECT_EQUAL(md.getDocId(), docId);
if (v->getCollectionType() == CollectionType::SINGLE || !weights) {
@@ -430,12 +431,12 @@ BitVectorTest::test(BasicType bt, CollectionType ct, const vespalib::string &pre
checkSearch(v, std::move(sc), 2, 1022, 205, !filter, true);
const search::IDocumentWeightAttribute *dwa = v->asDocumentWeightAttribute();
if (dwa != nullptr) {
- vespalib::string key = getSearchStr<VectorType>();
- search::IDocumentWeightAttribute::LookupResult lres = dwa->lookup(key, dwa->get_dictionary_snapshot());
+ search::IDocumentWeightAttribute::LookupResult lres =
+ dwa->lookup(getSearchStr<VectorType>(), dwa->get_dictionary_snapshot());
using DWSI = search::queryeval::DocumentWeightSearchIterator;
using SI = search::queryeval::SearchIterator;
TermFieldMatchData md;
- SI::UP dwsi = std::make_unique<DWSI>(md, *dwa, lres);
+ SI::UP dwsi(new DWSI(md, *dwa, lres));
if (!filter) {
TEST_DO(checkSearch(v, std::move(dwsi), md, 2, 1022, 205, !filter, true));
} else {
diff --git a/searchlib/src/tests/attribute/document_weight_iterator/document_weight_iterator_test.cpp b/searchlib/src/tests/attribute/document_weight_iterator/document_weight_iterator_test.cpp
index 98e70fd6c1f..56fe791021e 100644
--- a/searchlib/src/tests/attribute/document_weight_iterator/document_weight_iterator_test.cpp
+++ b/searchlib/src/tests/attribute/document_weight_iterator/document_weight_iterator_test.cpp
@@ -81,7 +81,6 @@ struct StringFixture {
};
TEST("require that appropriate attributes support the document weight attribute interface") {
- EXPECT_TRUE(make_attribute(BasicType::INT32, CollectionType::WSET, true)->asDocumentWeightAttribute() != nullptr);
EXPECT_TRUE(make_attribute(BasicType::INT64, CollectionType::WSET, true)->asDocumentWeightAttribute() != nullptr);
EXPECT_TRUE(make_attribute(BasicType::STRING, CollectionType::WSET, true)->asDocumentWeightAttribute() != nullptr);
}
@@ -97,7 +96,7 @@ TEST("require that inappropriate attributes do not support the document weight a
EXPECT_TRUE(make_attribute(BasicType::STRING, CollectionType::WSET, false)->asDocumentWeightAttribute() == nullptr);
EXPECT_TRUE(make_attribute(BasicType::STRING, CollectionType::SINGLE, true)->asDocumentWeightAttribute() == nullptr);
EXPECT_TRUE(make_attribute(BasicType::STRING, CollectionType::ARRAY, true)->asDocumentWeightAttribute() == nullptr);
- EXPECT_TRUE(make_attribute(BasicType::FLOAT, CollectionType::WSET, true)->asDocumentWeightAttribute() == nullptr);
+ EXPECT_TRUE(make_attribute(BasicType::INT32, CollectionType::WSET, true)->asDocumentWeightAttribute() == nullptr);
EXPECT_TRUE(make_attribute(BasicType::DOUBLE, CollectionType::WSET, true)->asDocumentWeightAttribute() == nullptr);
}
diff --git a/searchlib/src/vespa/searchlib/attribute/multinumericpostattribute.hpp b/searchlib/src/vespa/searchlib/attribute/multinumericpostattribute.hpp
index f652a3b95b9..89ef0a7d8a0 100644
--- a/searchlib/src/vespa/searchlib/attribute/multinumericpostattribute.hpp
+++ b/searchlib/src/vespa/searchlib/attribute/multinumericpostattribute.hpp
@@ -126,6 +126,7 @@ template <typename B, typename M>
void
MultiValueNumericPostingAttribute<B, M>::DocumentWeightAttributeAdapter::create(vespalib::datastore::EntryRef idx, std::vector<DocumentWeightIterator> &dst) const
{
+ assert(idx.valid());
self.getPostingList().beginFrozen(idx, dst);
}
@@ -133,6 +134,7 @@ template <typename B, typename M>
DocumentWeightIterator
MultiValueNumericPostingAttribute<B, M>::DocumentWeightAttributeAdapter::create(vespalib::datastore::EntryRef idx) const
{
+ assert(idx.valid());
return self.getPostingList().beginFrozen(idx);
}
@@ -154,7 +156,7 @@ template <typename B, typename M>
const IDocumentWeightAttribute *
MultiValueNumericPostingAttribute<B, M>::asDocumentWeightAttribute() const
{
- if (this->hasWeightedSetType() && this->isIntegerType()) {
+ if (this->hasWeightedSetType() && (this->getBasicType() == AttributeVector::BasicType::INT64)) {
return &_document_weight_attribute_adapter;
}
return nullptr;
diff --git a/searchlib/src/vespa/searchlib/attribute/multistringpostattribute.hpp b/searchlib/src/vespa/searchlib/attribute/multistringpostattribute.hpp
index b8844583911..3042a9d0bb9 100644
--- a/searchlib/src/vespa/searchlib/attribute/multistringpostattribute.hpp
+++ b/searchlib/src/vespa/searchlib/attribute/multistringpostattribute.hpp
@@ -146,6 +146,7 @@ template <typename B, typename T>
void
MultiValueStringPostingAttributeT<B, T>::DocumentWeightAttributeAdapter::create(vespalib::datastore::EntryRef idx, std::vector<DocumentWeightIterator> &dst) const
{
+ assert(idx.valid());
self.getPostingList().beginFrozen(idx, dst);
}
@@ -153,6 +154,7 @@ template <typename B, typename M>
DocumentWeightIterator
MultiValueStringPostingAttributeT<B, M>::DocumentWeightAttributeAdapter::create(vespalib::datastore::EntryRef idx) const
{
+ assert(idx.valid());
return self.getPostingList().beginFrozen(idx);
}
@@ -174,7 +176,7 @@ template <typename B, typename T>
const IDocumentWeightAttribute *
MultiValueStringPostingAttributeT<B, T>::asDocumentWeightAttribute() const
{
- if (this->hasWeightedSetType() && (this->isStringType())) {
+ if (this->hasWeightedSetType() && (this->getBasicType() == AttributeVector::BasicType::STRING)) {
return &_document_weight_attribute_adapter;
}
return nullptr;