summaryrefslogtreecommitdiffstats
path: root/searchlib
diff options
context:
space:
mode:
authorGeir Storli <geirst@yahooinc.com>2023-11-23 16:30:02 +0100
committerGitHub <noreply@github.com>2023-11-23 16:30:02 +0100
commitdd94d619668210d09792597cbd218994058e923e (patch)
tree08cc40f74d66e200b8bcc58a2d08cceb4594889f /searchlib
parent3cae52a5ab51ecf162f0eaa048615ba9b6c607cb (diff)
parent6d19a414926742a1be4c6d591a8d5c2c93e9f939 (diff)
Merge pull request #29448 from vespa-engine/geirst/refactor-apis-for-posting-list-access
Refactor apis for attribute posting list access
Diffstat (limited to 'searchlib')
-rw-r--r--searchlib/src/apps/tests/document_weight_attribute_lookup_stress_test.cpp6
-rw-r--r--searchlib/src/tests/attribute/bitvector/bitvector_test.cpp26
-rw-r--r--searchlib/src/tests/attribute/document_weight_iterator/document_weight_iterator_test.cpp60
-rw-r--r--searchlib/src/tests/attribute/document_weight_or_filter_search/document_weight_or_filter_search_test.cpp2
-rw-r--r--searchlib/src/tests/attribute/imported_attribute_vector/imported_attribute_vector_test.cpp4
-rw-r--r--searchlib/src/tests/attribute/searchable/attributeblueprint_test.cpp2
-rw-r--r--searchlib/src/tests/queryeval/dot_product/dot_product_test.cpp4
-rw-r--r--searchlib/src/tests/queryeval/matching_elements_search/matching_elements_search_test.cpp20
-rw-r--r--searchlib/src/tests/queryeval/parallel_weak_and/parallel_weak_and_test.cpp43
-rw-r--r--searchlib/src/tests/queryeval/weighted_set_term/weighted_set_term_test.cpp4
-rw-r--r--searchlib/src/vespa/searchcommon/attribute/iattributevector.h6
-rw-r--r--searchlib/src/vespa/searchlib/attribute/CMakeLists.txt4
-rw-r--r--searchlib/src/vespa/searchlib/attribute/array_iterator.cpp (renamed from searchlib/src/vespa/searchlib/attribute/dociditerator.cpp)2
-rw-r--r--searchlib/src/vespa/searchlib/attribute/array_iterator.h (renamed from searchlib/src/vespa/searchlib/attribute/dociditerator.h)18
-rw-r--r--searchlib/src/vespa/searchlib/attribute/attribute_blueprint_factory.cpp66
-rw-r--r--searchlib/src/vespa/searchlib/attribute/attributeiterators.h2
-rw-r--r--searchlib/src/vespa/searchlib/attribute/attributeiterators.hpp2
-rw-r--r--searchlib/src/vespa/searchlib/attribute/attributevector.cpp2
-rw-r--r--searchlib/src/vespa/searchlib/attribute/attributevector.h5
-rw-r--r--searchlib/src/vespa/searchlib/attribute/direct_weighted_set_blueprint.h22
-rw-r--r--searchlib/src/vespa/searchlib/attribute/direct_weighted_set_blueprint.hpp10
-rw-r--r--searchlib/src/vespa/searchlib/attribute/document_weight_or_filter_search.cpp2
-rw-r--r--searchlib/src/vespa/searchlib/attribute/document_weight_or_filter_search.h4
-rw-r--r--searchlib/src/vespa/searchlib/attribute/i_direct_posting_store.cpp (renamed from searchlib/src/vespa/searchlib/attribute/i_document_weight_attribute.cpp)10
-rw-r--r--searchlib/src/vespa/searchlib/attribute/i_direct_posting_store.h (renamed from searchlib/src/vespa/searchlib/attribute/i_document_weight_attribute.h)17
-rw-r--r--searchlib/src/vespa/searchlib/attribute/i_docid_with_weight_posting_store.h21
-rw-r--r--searchlib/src/vespa/searchlib/attribute/imported_attribute_vector_read_guard.cpp2
-rw-r--r--searchlib/src/vespa/searchlib/attribute/imported_attribute_vector_read_guard.h2
-rw-r--r--searchlib/src/vespa/searchlib/attribute/imported_search_context.cpp2
-rw-r--r--searchlib/src/vespa/searchlib/attribute/iterator_pack.cpp2
-rw-r--r--searchlib/src/vespa/searchlib/attribute/iterator_pack.h6
-rw-r--r--searchlib/src/vespa/searchlib/attribute/multinumericpostattribute.h15
-rw-r--r--searchlib/src/vespa/searchlib/attribute/multinumericpostattribute.hpp28
-rw-r--r--searchlib/src/vespa/searchlib/attribute/multistringpostattribute.h15
-rw-r--r--searchlib/src/vespa/searchlib/attribute/multistringpostattribute.hpp28
-rw-r--r--searchlib/src/vespa/searchlib/attribute/postinglistattribute.h2
-rw-r--r--searchlib/src/vespa/searchlib/attribute/postinglistsearchcontext.hpp4
-rw-r--r--searchlib/src/vespa/searchlib/queryeval/document_weight_search_iterator.h8
-rw-r--r--searchlib/src/vespa/searchlib/queryeval/dot_product_search.cpp2
-rw-r--r--searchlib/src/vespa/searchlib/queryeval/dot_product_search.h2
-rw-r--r--searchlib/src/vespa/searchlib/queryeval/matching_elements_search.cpp9
-rw-r--r--searchlib/src/vespa/searchlib/queryeval/matching_elements_search.h4
-rw-r--r--searchlib/src/vespa/searchlib/queryeval/wand/parallel_weak_and_search.cpp4
-rw-r--r--searchlib/src/vespa/searchlib/queryeval/wand/parallel_weak_and_search.h4
-rw-r--r--searchlib/src/vespa/searchlib/queryeval/wand/wand_parts.h14
-rw-r--r--searchlib/src/vespa/searchlib/queryeval/weighted_set_term_search.cpp2
-rw-r--r--searchlib/src/vespa/searchlib/queryeval/weighted_set_term_search.h2
-rw-r--r--searchlib/src/vespa/searchlib/test/document_weight_attribute_helper.h10
-rw-r--r--searchlib/src/vespa/searchlib/test/weightedchildrenverifiers.h14
49 files changed, 284 insertions, 261 deletions
diff --git a/searchlib/src/apps/tests/document_weight_attribute_lookup_stress_test.cpp b/searchlib/src/apps/tests/document_weight_attribute_lookup_stress_test.cpp
index 30b3292e6b4..0f5ae52115a 100644
--- a/searchlib/src/apps/tests/document_weight_attribute_lookup_stress_test.cpp
+++ b/searchlib/src/apps/tests/document_weight_attribute_lookup_stress_test.cpp
@@ -2,7 +2,7 @@
#include <vespa/searchlib/attribute/attributefactory.h>
#include <vespa/searchlib/attribute/integerbase.h>
-#include <vespa/searchlib/attribute/i_document_weight_attribute.h>
+#include <vespa/searchlib/attribute/i_docid_with_weight_posting_store.h>
#include <vespa/searchcommon/attribute/config.h>
#include <vespa/vespalib/gtest/gtest.h>
#include <random>
@@ -28,7 +28,7 @@ Config make_config(bool hash)
return cfg;
}
-class MyKey : public search::IDocumentWeightAttribute::LookupKey
+class MyKey : public search::IDirectPostingStore::LookupKey
{
int64_t _key;
public:
@@ -118,7 +118,7 @@ DocumentWeightAttributeLookupStressTest::lookup_loop(AttributeVector& attr, uint
size_t lookups = loops * _lookup_keys.size();
std::cout << "Performing " << lookups << " " << attr.getName() << " lookups" << std::endl;
auto before = steady_clock::now();
- auto dwa = attr.asDocumentWeightAttribute();
+ auto dwa = attr.as_docid_with_weight_posting_store();
uint64_t hits = 0;
uint64_t misses = 0;
for (uint32_t loop = 0; loop < loops; ++loop) {
diff --git a/searchlib/src/tests/attribute/bitvector/bitvector_test.cpp b/searchlib/src/tests/attribute/bitvector/bitvector_test.cpp
index dfea4901180..181c0fdf110 100644
--- a/searchlib/src/tests/attribute/bitvector/bitvector_test.cpp
+++ b/searchlib/src/tests/attribute/bitvector/bitvector_test.cpp
@@ -1,23 +1,21 @@
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include <vespa/vespalib/testkit/testapp.h>
-
+#include <vespa/searchcommon/attribute/config.h>
#include <vespa/searchlib/attribute/attribute.h>
#include <vespa/searchlib/attribute/attributefactory.h>
-#include <vespa/searchlib/util/randomgenerator.h>
-#include <vespa/vespalib/util/compress.h>
+#include <vespa/searchlib/attribute/i_docid_with_weight_posting_store.h>
+#include <vespa/searchlib/common/bitvectoriterator.h>
#include <vespa/searchlib/fef/termfieldmatchdata.h>
-#include <vespa/searchlib/attribute/i_document_weight_attribute.h>
+#include <vespa/searchlib/parsequery/parse.h>
#include <vespa/searchlib/queryeval/document_weight_search_iterator.h>
-#include <vespa/searchlib/test/searchiteratorverifier.h>
-#include <vespa/searchlib/common/bitvectoriterator.h>
#include <vespa/searchlib/queryeval/executeinfo.h>
-#include <vespa/searchlib/parsequery/parse.h>
-#include <vespa/searchcommon/attribute/config.h>
+#include <vespa/searchlib/test/searchiteratorverifier.h>
+#include <vespa/searchlib/util/randomgenerator.h>
#include <vespa/vespalib/stllike/asciistream.h>
+#include <vespa/vespalib/testkit/testapp.h>
+#include <vespa/vespalib/util/compress.h>
#include <vespa/log/log.h>
-
LOG_SETUP("bitvector_test");
using search::AttributeFactory;
@@ -431,12 +429,12 @@ BitVectorTest::test(BasicType bt, CollectionType ct, const vespalib::string &pre
checkSearch(v, std::move(sc), 2, 1022, 205, !fastSearch && !filter, true);
sc = getSearch<VectorType>(tv, filter);
checkSearch(v, std::move(sc), 2, 1022, 205, !filter, true);
- const search::IDocumentWeightAttribute *dwa = v->asDocumentWeightAttribute();
- if (dwa != nullptr) {
- auto lres = dwa->lookup(getSearchStr<VectorType>(), dwa->get_dictionary_snapshot());
+ const auto* dww = v->as_docid_with_weight_posting_store();
+ if (dww != nullptr) {
+ auto lres = dww->lookup(getSearchStr<VectorType>(), dww->get_dictionary_snapshot());
using DWSI = search::queryeval::DocumentWeightSearchIterator;
TermFieldMatchData md;
- auto dwsi = std::make_unique<DWSI>(md, *dwa, lres);
+ auto dwsi = std::make_unique<DWSI>(md, *dww, 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 6b0ddbc6e35..28416d09d6f 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
@@ -1,18 +1,18 @@
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+#include <vespa/searchcommon/attribute/config.h>
#include <vespa/searchlib/attribute/attribute.h>
+#include <vespa/searchlib/attribute/attribute_read_guard.h>
#include <vespa/searchlib/attribute/attributefactory.h>
#include <vespa/searchlib/attribute/attributeguard.h>
-#include <vespa/searchlib/attribute/attribute_read_guard.h>
#include <vespa/searchlib/attribute/attributememorysavetarget.h>
-#include <vespa/searchlib/attribute/i_document_weight_attribute.h>
+#include <vespa/searchlib/attribute/i_docid_with_weight_posting_store.h>
#include <vespa/searchlib/index/dummyfileheadercontext.h>
#include <vespa/searchlib/queryeval/document_weight_search_iterator.h>
#include <vespa/searchlib/test/searchiteratorverifier.h>
#include <vespa/searchlib/util/randomgenerator.h>
-#include <vespa/searchcommon/attribute/config.h>
-#include <vespa/vespalib/testkit/test_kit.h>
#include <vespa/vespalib/test/insertion_operators.h>
+#include <vespa/vespalib/testkit/test_kit.h>
#include <vespa/log/log.h>
LOG_SETUP("document_weight_iterator_test");
@@ -58,9 +58,9 @@ void populate_string(AttributeVector::SP attr_ptr) {
struct LongFixture {
AttributeVector::SP attr;
- const IDocumentWeightAttribute *api;
+ const IDocidWithWeightPostingStore *api;
LongFixture() : attr(make_attribute(BasicType::INT64, CollectionType::WSET, true)),
- api(attr->asDocumentWeightAttribute())
+ api(attr->as_docid_with_weight_posting_store())
{
ASSERT_TRUE(api != nullptr);
add_docs(attr);
@@ -70,9 +70,9 @@ struct LongFixture {
struct StringFixture {
AttributeVector::SP attr;
- const IDocumentWeightAttribute *api;
+ const IDocidWithWeightPostingStore *api;
StringFixture() : attr(make_attribute(BasicType::STRING, CollectionType::WSET, true)),
- api(attr->asDocumentWeightAttribute())
+ api(attr->as_docid_with_weight_posting_store())
{
ASSERT_TRUE(api != nullptr);
add_docs(attr);
@@ -81,33 +81,33 @@ struct StringFixture {
};
TEST("require that appropriate attributes support the document weight attribute interface") {
- EXPECT_TRUE(make_attribute(BasicType::INT64, CollectionType::WSET, true)->asDocumentWeightAttribute() != nullptr);
- EXPECT_TRUE(make_attribute(BasicType::STRING, CollectionType::WSET, true)->asDocumentWeightAttribute() != nullptr);
+ EXPECT_TRUE(make_attribute(BasicType::INT64, CollectionType::WSET, true)->as_docid_with_weight_posting_store() != nullptr);
+ EXPECT_TRUE(make_attribute(BasicType::STRING, CollectionType::WSET, true)->as_docid_with_weight_posting_store() != nullptr);
}
TEST("require that inappropriate attributes do not support the document weight attribute interface") {
- EXPECT_TRUE(make_attribute(BasicType::INT64, CollectionType::SINGLE, false)->asDocumentWeightAttribute() == nullptr);
- EXPECT_TRUE(make_attribute(BasicType::INT64, CollectionType::ARRAY, false)->asDocumentWeightAttribute() == nullptr);
- EXPECT_TRUE(make_attribute(BasicType::INT64, CollectionType::WSET, false)->asDocumentWeightAttribute() == nullptr);
- EXPECT_TRUE(make_attribute(BasicType::INT64, CollectionType::SINGLE, true)->asDocumentWeightAttribute() == nullptr);
- EXPECT_TRUE(make_attribute(BasicType::INT64, CollectionType::ARRAY, true)->asDocumentWeightAttribute() == nullptr);
- EXPECT_TRUE(make_attribute(BasicType::STRING, CollectionType::SINGLE, false)->asDocumentWeightAttribute() == nullptr);
- EXPECT_TRUE(make_attribute(BasicType::STRING, CollectionType::ARRAY, false)->asDocumentWeightAttribute() == nullptr);
- 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::INT32, CollectionType::WSET, true)->asDocumentWeightAttribute() == nullptr);
- EXPECT_TRUE(make_attribute(BasicType::DOUBLE, CollectionType::WSET, true)->asDocumentWeightAttribute() == nullptr);
-}
-
-void verify_valid_lookup(IDocumentWeightAttribute::LookupResult result) {
+ EXPECT_TRUE(make_attribute(BasicType::INT64, CollectionType::SINGLE, false)->as_docid_with_weight_posting_store() == nullptr);
+ EXPECT_TRUE(make_attribute(BasicType::INT64, CollectionType::ARRAY, false)->as_docid_with_weight_posting_store() == nullptr);
+ EXPECT_TRUE(make_attribute(BasicType::INT64, CollectionType::WSET, false)->as_docid_with_weight_posting_store() == nullptr);
+ EXPECT_TRUE(make_attribute(BasicType::INT64, CollectionType::SINGLE, true)->as_docid_with_weight_posting_store() == nullptr);
+ EXPECT_TRUE(make_attribute(BasicType::INT64, CollectionType::ARRAY, true)->as_docid_with_weight_posting_store() == nullptr);
+ EXPECT_TRUE(make_attribute(BasicType::STRING, CollectionType::SINGLE, false)->as_docid_with_weight_posting_store() == nullptr);
+ EXPECT_TRUE(make_attribute(BasicType::STRING, CollectionType::ARRAY, false)->as_docid_with_weight_posting_store() == nullptr);
+ EXPECT_TRUE(make_attribute(BasicType::STRING, CollectionType::WSET, false)->as_docid_with_weight_posting_store() == nullptr);
+ EXPECT_TRUE(make_attribute(BasicType::STRING, CollectionType::SINGLE, true)->as_docid_with_weight_posting_store() == nullptr);
+ EXPECT_TRUE(make_attribute(BasicType::STRING, CollectionType::ARRAY, true)->as_docid_with_weight_posting_store() == nullptr);
+ EXPECT_TRUE(make_attribute(BasicType::INT32, CollectionType::WSET, true)->as_docid_with_weight_posting_store() == nullptr);
+ EXPECT_TRUE(make_attribute(BasicType::DOUBLE, CollectionType::WSET, true)->as_docid_with_weight_posting_store() == nullptr);
+}
+
+void verify_valid_lookup(IDirectPostingStore::LookupResult result) {
EXPECT_TRUE(result.posting_idx.valid());
EXPECT_EQUAL(3u, result.posting_size);
EXPECT_EQUAL(5, result.min_weight);
EXPECT_EQUAL(20, result.max_weight);
}
-void verify_invalid_lookup(IDocumentWeightAttribute::LookupResult result) {
+void verify_invalid_lookup(IDirectPostingStore::LookupResult result) {
EXPECT_FALSE(result.posting_idx.valid());
EXPECT_EQUAL(0u, result.posting_size);
EXPECT_EQUAL(0, result.min_weight);
@@ -124,14 +124,14 @@ TEST_F("require string lookup works correctly", StringFixture) {
verify_invalid_lookup(f1.api->lookup("bar", f1.api->get_dictionary_snapshot()));
}
-void verify_posting(const IDocumentWeightAttribute &api, const char *term) {
+void verify_posting(const IDocidWithWeightPostingStore &api, const char *term) {
auto result = api.lookup(term, api.get_dictionary_snapshot());
ASSERT_TRUE(result.posting_idx.valid());
- std::vector<DocumentWeightIterator> itr_store;
+ std::vector<DocidWithWeightIterator> itr_store;
api.create(result.posting_idx, itr_store);
ASSERT_EQUAL(1u, itr_store.size());
{
- DocumentWeightIterator &itr = itr_store[0];
+ DocidWithWeightIterator &itr = itr_store[0];
if (itr.valid() && itr.getKey() < 1) {
itr.linearSeek(1);
}
@@ -195,7 +195,7 @@ public:
~Verifier();
SearchIterator::UP create(bool strict) const override {
(void) strict;
- const IDocumentWeightAttribute *api(_attr->asDocumentWeightAttribute());
+ const auto* api = _attr->as_docid_with_weight_posting_store();
ASSERT_TRUE(api != nullptr);
auto dict_entry = api->lookup("123", api->get_dictionary_snapshot());
ASSERT_TRUE(dict_entry.posting_idx.valid());
diff --git a/searchlib/src/tests/attribute/document_weight_or_filter_search/document_weight_or_filter_search_test.cpp b/searchlib/src/tests/attribute/document_weight_or_filter_search/document_weight_or_filter_search_test.cpp
index 804e2fdfbd9..ae4812b5437 100644
--- a/searchlib/src/tests/attribute/document_weight_or_filter_search/document_weight_or_filter_search_test.cpp
+++ b/searchlib/src/tests/attribute/document_weight_or_filter_search/document_weight_or_filter_search_test.cpp
@@ -1,7 +1,7 @@
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include <vespa/vespalib/gtest/gtest.h>
-#include <vespa/searchlib/attribute/i_document_weight_attribute.h>
+#include <vespa/searchlib/attribute/i_direct_posting_store.h>
#include <vespa/searchlib/attribute/document_weight_or_filter_search.h>
#include <vespa/searchlib/queryeval/searchiterator.h>
#include <vespa/searchlib/common/bitvector.h>
diff --git a/searchlib/src/tests/attribute/imported_attribute_vector/imported_attribute_vector_test.cpp b/searchlib/src/tests/attribute/imported_attribute_vector/imported_attribute_vector_test.cpp
index eafbbfff103..53fe3c4046a 100644
--- a/searchlib/src/tests/attribute/imported_attribute_vector/imported_attribute_vector_test.cpp
+++ b/searchlib/src/tests/attribute/imported_attribute_vector/imported_attribute_vector_test.cpp
@@ -140,8 +140,8 @@ TEST_F("getFixedWidth() is inherited from target attribute vector", Fixture) {
f.get_imported_attr()->getFixedWidth());
}
-TEST_F("asDocumentWeightAttribute() returns nullptr", Fixture) {
- EXPECT_TRUE(f.get_imported_attr()->asDocumentWeightAttribute() == nullptr);
+TEST_F("as_docid_with_weight_posting_store() returns nullptr", Fixture) {
+ EXPECT_TRUE(f.get_imported_attr()->as_docid_with_weight_posting_store() == nullptr);
}
TEST_F("asTensorAttribute() returns nullptr", Fixture) {
diff --git a/searchlib/src/tests/attribute/searchable/attributeblueprint_test.cpp b/searchlib/src/tests/attribute/searchable/attributeblueprint_test.cpp
index e618b091a7e..39869340cea 100644
--- a/searchlib/src/tests/attribute/searchable/attributeblueprint_test.cpp
+++ b/searchlib/src/tests/attribute/searchable/attributeblueprint_test.cpp
@@ -315,7 +315,7 @@ public:
return result;
}
void expect_document_weight_attribute() {
- EXPECT_TRUE(attr->asDocumentWeightAttribute() != nullptr);
+ EXPECT_TRUE(attr->as_docid_with_weight_posting_store() != nullptr);
}
void expect_filter_search(const SimpleResult& upper_and_lower, const Node& term) {
expect_filter_search(upper_and_lower, upper_and_lower, term);
diff --git a/searchlib/src/tests/queryeval/dot_product/dot_product_test.cpp b/searchlib/src/tests/queryeval/dot_product/dot_product_test.cpp
index 1538a9ce0df..357065d8667 100644
--- a/searchlib/src/tests/queryeval/dot_product/dot_product_test.cpp
+++ b/searchlib/src/tests/queryeval/dot_product/dot_product_test.cpp
@@ -274,10 +274,10 @@ private:
}
};
-class WeightIteratorChildrenVerifier : public search::test::DwaIteratorChildrenVerifier {
+class WeightIteratorChildrenVerifier : public search::test::DwwIteratorChildrenVerifier {
private:
SearchIterator::UP
- create(std::vector<DocumentWeightIterator> && children) const override {
+ create(std::vector<DocidWithWeightIterator> && children) const override {
return DotProductSearch::create(_tfmd, false, _weights, std::move(children));
}
};
diff --git a/searchlib/src/tests/queryeval/matching_elements_search/matching_elements_search_test.cpp b/searchlib/src/tests/queryeval/matching_elements_search/matching_elements_search_test.cpp
index b1ff582f3ff..03d7201e103 100644
--- a/searchlib/src/tests/queryeval/matching_elements_search/matching_elements_search_test.cpp
+++ b/searchlib/src/tests/queryeval/matching_elements_search/matching_elements_search_test.cpp
@@ -1,26 +1,26 @@
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include <vespa/searchcommon/attribute/attributecontent.h>
+#include <vespa/searchcommon/attribute/config.h>
#include <vespa/searchlib/attribute/attributefactory.h>
#include <vespa/searchlib/attribute/attributevector.h>
-#include <vespa/searchlib/attribute/stringbase.h>
+#include <vespa/searchlib/attribute/i_docid_with_weight_posting_store.h>
#include <vespa/searchlib/attribute/integerbase.h>
-#include <vespa/searchlib/attribute/i_document_weight_attribute.h>
+#include <vespa/searchlib/attribute/stringbase.h>
#include <vespa/searchlib/common/matching_elements.h>
#include <vespa/searchlib/queryeval/matching_elements_search.h>
-#include <vespa/searchcommon/attribute/config.h>
#include <vespa/vespalib/gtest/gtest.h>
-using search::attribute::BasicType;
-using search::attribute::CollectionType;
-using search::attribute::Config;
-using search::queryeval::MatchingElementsSearch;
using search::AttributeFactory;
using search::AttributeVector;
-using search::IDocumentWeightAttribute;
+using search::IDirectPostingStore;
using search::IntegerAttribute;
using search::MatchingElements;
using search::StringAttribute;
+using search::attribute::BasicType;
+using search::attribute::CollectionType;
+using search::attribute::Config;
+using search::queryeval::MatchingElementsSearch;
std::shared_ptr<AttributeVector> make_attribute(BasicType type) {
Config cfg(type, CollectionType::WSET);
@@ -36,8 +36,8 @@ std::shared_ptr<AttributeVector> make_attribute(BasicType type) {
std::unique_ptr<MatchingElementsSearch> make_search(AttributeVector &attr, const std::vector<vespalib::string> &terms)
{
- using LookupResult = IDocumentWeightAttribute::LookupResult;
- auto dwa = attr.asDocumentWeightAttribute();
+ using LookupResult = IDirectPostingStore::LookupResult;
+ auto dwa = attr.as_docid_with_weight_posting_store();
assert(dwa != nullptr);
auto snapshot = dwa->get_dictionary_snapshot();
std::vector<LookupResult> dict_entries;
diff --git a/searchlib/src/tests/queryeval/parallel_weak_and/parallel_weak_and_test.cpp b/searchlib/src/tests/queryeval/parallel_weak_and/parallel_weak_and_test.cpp
index 6d7d8b42dbb..58f22f19da1 100644
--- a/searchlib/src/tests/queryeval/parallel_weak_and/parallel_weak_and_test.cpp
+++ b/searchlib/src/tests/queryeval/parallel_weak_and/parallel_weak_and_test.cpp
@@ -1,17 +1,17 @@
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include <vespa/vespalib/testkit/test_kit.h>
#include <vespa/searchlib/query/tree/simplequery.h>
-#include <vespa/searchlib/queryeval/fake_searchable.h>
+#include <vespa/searchlib/queryeval/document_weight_search_iterator.h>
#include <vespa/searchlib/queryeval/fake_requestcontext.h>
-#include <vespa/searchlib/queryeval/wand/parallel_weak_and_blueprint.h>
-#include <vespa/searchlib/queryeval/wand/parallel_weak_and_search.h>
+#include <vespa/searchlib/queryeval/fake_searchable.h>
#include <vespa/searchlib/queryeval/simpleresult.h>
#include <vespa/searchlib/queryeval/test/eagerchild.h>
#include <vespa/searchlib/queryeval/test/leafspec.h>
#include <vespa/searchlib/queryeval/test/wandspec.h>
-#include <vespa/searchlib/test/weightedchildrenverifiers.h>
+#include <vespa/searchlib/queryeval/wand/parallel_weak_and_blueprint.h>
+#include <vespa/searchlib/queryeval/wand/parallel_weak_and_search.h>
#include <vespa/searchlib/test/document_weight_attribute_helper.h>
-#include <vespa/searchlib/queryeval/document_weight_search_iterator.h>
+#include <vespa/searchlib/test/weightedchildrenverifiers.h>
+#include <vespa/vespalib/testkit/test_kit.h>
using namespace search::query;
using namespace search::queryeval;
@@ -21,12 +21,13 @@ using feature_t = search::feature_t;
using score_t = wand::score_t;
using MatchParams = ParallelWeakAndSearch::MatchParams;
using RankParams = ParallelWeakAndSearch::RankParams;
-using search::test::DocumentWeightAttributeHelper;
-using search::IDocumentWeightAttribute;
-using search::fef::TermFieldMatchData;
+using search::IDirectPostingStore;
+using search::IDocidWithWeightPostingStore;
using search::fef::MatchData;
using search::fef::MatchDataLayout;
using search::fef::TermFieldHandle;
+using search::fef::TermFieldMatchData;
+using search::test::DocumentWeightAttributeHelper;
struct Scores : public std::vector<score_t>
@@ -635,15 +636,15 @@ struct DummyHeap : public WeakAndHeap {
void adjust(score_t *, score_t *) override {}
};
-SearchIterator::UP create_wand(bool use_dwa,
+SearchIterator::UP create_wand(bool use_dww,
TermFieldMatchData &tfmd,
const MatchParams &matchParams,
const std::vector<int32_t> &weights,
- const std::vector<IDocumentWeightAttribute::LookupResult> &dict_entries,
- const IDocumentWeightAttribute &attr,
+ const std::vector<IDirectPostingStore::LookupResult> &dict_entries,
+ const IDocidWithWeightPostingStore &attr,
bool strict)
{
- if (use_dwa) {
+ if (use_dww) {
return ParallelWeakAndSearch::create(tfmd, matchParams, weights, dict_entries, attr, strict);
}
// use search iterators as children
@@ -665,25 +666,25 @@ SearchIterator::UP create_wand(bool use_dwa,
return SearchIterator::UP(ParallelWeakAndSearch::create(terms, matchParams, RankParams(tfmd, std::move(childrenMatchData)), strict));
}
-class Verifier : public search::test::DwaIteratorChildrenVerifier {
+class Verifier : public search::test::DwwIteratorChildrenVerifier {
public:
- Verifier(bool use_dwa) : _use_dwa(use_dwa) { }
+ Verifier(bool use_dww) : _use_dww(use_dww) { }
private:
SearchIterator::UP create(bool strict) const override {
MatchParams match_params(_dummy_heap, _dummy_heap.getMinScore(), 1.0, 1);
- std::vector<IDocumentWeightAttribute::LookupResult> dict_entries;
+ std::vector<IDirectPostingStore::LookupResult> dict_entries;
for (size_t i = 0; i < _num_children; ++i) {
- dict_entries.push_back(_helper.dwa().lookup(vespalib::make_string("%zu", i).c_str(), _helper.dwa().get_dictionary_snapshot()));
+ dict_entries.push_back(_helper.dww().lookup(vespalib::make_string("%zu", i).c_str(), _helper.dww().get_dictionary_snapshot()));
}
- return create_wand(_use_dwa, _tfmd, match_params, _weights, dict_entries, _helper.dwa(), strict);
+ return create_wand(_use_dww, _tfmd, match_params, _weights, dict_entries, _helper.dww(), strict);
}
- bool _use_dwa;
+ bool _use_dww;
mutable DummyHeap _dummy_heap;
};
TEST("verify search iterator conformance") {
- for (bool use_dwa: {false, true}) {
- Verifier verifier(use_dwa);
+ for (bool use_dww: {false, true}) {
+ Verifier verifier(use_dww);
verifier.verify();
}
}
diff --git a/searchlib/src/tests/queryeval/weighted_set_term/weighted_set_term_test.cpp b/searchlib/src/tests/queryeval/weighted_set_term/weighted_set_term_test.cpp
index fed4e7c9bbd..fffa4b3c5ba 100644
--- a/searchlib/src/tests/queryeval/weighted_set_term/weighted_set_term_test.cpp
+++ b/searchlib/src/tests/queryeval/weighted_set_term/weighted_set_term_test.cpp
@@ -289,9 +289,9 @@ private:
}
};
-class WeightIteratorChildrenVerifier : public search::test::DwaIteratorChildrenVerifier {
+class WeightIteratorChildrenVerifier : public search::test::DwwIteratorChildrenVerifier {
private:
- SearchIterator::UP create(std::vector<DocumentWeightIterator> && children) const override {
+ SearchIterator::UP create(std::vector<DocidWithWeightIterator> && children) const override {
return WeightedSetTermSearch::create(_tfmd, false, _weights, std::move(children));
}
};
diff --git a/searchlib/src/vespa/searchcommon/attribute/iattributevector.h b/searchlib/src/vespa/searchcommon/attribute/iattributevector.h
index b44b6a4baf2..0576dd85600 100644
--- a/searchlib/src/vespa/searchcommon/attribute/iattributevector.h
+++ b/searchlib/src/vespa/searchcommon/attribute/iattributevector.h
@@ -11,7 +11,7 @@
#include <vector>
namespace search {
- struct IDocumentWeightAttribute;
+ class IDocidWithWeightPostingStore;
class QueryTermSimple;
}
@@ -293,11 +293,11 @@ public:
const SearchContextParams &params) const = 0;
/**
- * Type-safe down-cast to an attribute supporting direct document weight iterators.
+ * Type-safe down-cast to an attribute supporting direct access to posting lists with docid and weight.
*
* @return document weight attribute or nullptr if not supported.
*/
- virtual const IDocumentWeightAttribute *asDocumentWeightAttribute() const = 0;
+ virtual const IDocidWithWeightPostingStore *as_docid_with_weight_posting_store() const = 0;
/**
* Type-safe down-cast to a tensor attribute.
diff --git a/searchlib/src/vespa/searchlib/attribute/CMakeLists.txt b/searchlib/src/vespa/searchlib/attribute/CMakeLists.txt
index 6ec78daecd1..4735b3d7158 100644
--- a/searchlib/src/vespa/searchlib/attribute/CMakeLists.txt
+++ b/searchlib/src/vespa/searchlib/attribute/CMakeLists.txt
@@ -3,6 +3,7 @@ vespa_add_library(searchlib_attribute OBJECT
SOURCES
address_space_components.cpp
address_space_usage.cpp
+ array_iterator.cpp
attribute.cpp
attribute_blueprint_factory.cpp
attribute_header.cpp
@@ -42,7 +43,6 @@ vespa_add_library(searchlib_attribute OBJECT
direct_weighted_set_blueprint.cpp
distance_metric_utils.cpp
diversity.cpp
- dociditerator.cpp
document_weight_or_filter_search.cpp
empty_search_context.cpp
enum_store_compaction_spec.cpp
@@ -63,7 +63,7 @@ vespa_add_library(searchlib_attribute OBJECT
fixedsourceselector.cpp
flagattribute.cpp
floatbase.cpp
- i_document_weight_attribute.cpp
+ i_direct_posting_store.cpp
i_enum_store.cpp
iattributemanager.cpp
iattributesavetarget.cpp
diff --git a/searchlib/src/vespa/searchlib/attribute/dociditerator.cpp b/searchlib/src/vespa/searchlib/attribute/array_iterator.cpp
index cf1ff298b97..0a6107d67dc 100644
--- a/searchlib/src/vespa/searchlib/attribute/dociditerator.cpp
+++ b/searchlib/src/vespa/searchlib/attribute/array_iterator.cpp
@@ -1,6 +1,6 @@
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include "dociditerator.h"
+#include "array_iterator.h"
namespace search {
diff --git a/searchlib/src/vespa/searchlib/attribute/dociditerator.h b/searchlib/src/vespa/searchlib/attribute/array_iterator.h
index 929650a024e..b1db2fdd428 100644
--- a/searchlib/src/vespa/searchlib/attribute/dociditerator.h
+++ b/searchlib/src/vespa/searchlib/attribute/array_iterator.h
@@ -9,19 +9,17 @@
namespace search {
/**
- * Inner attribute iterator used for temporary posting lists (range
- * searches).
+ * Inner attribute iterator used for temporary posting lists (range searches).
*/
-
template <typename P>
-class DocIdIterator
+class ArrayIterator
{
public:
- DocIdIterator() : _cur(nullptr), _end(nullptr), _begin(nullptr) { }
+ ArrayIterator() : _cur(nullptr), _end(nullptr), _begin(nullptr) { }
const P * operator->() const { return _cur; }
- DocIdIterator & operator++() {
+ ArrayIterator & operator++() {
++_cur;
return *this;
}
@@ -49,7 +47,7 @@ public:
_cur = std::lower_bound<const P *, P>(_begin, _end, keyWrap);
}
- void swap(DocIdIterator &rhs) {
+ void swap(ArrayIterator &rhs) {
std::swap(_cur, rhs._cur);
std::swap(_end, rhs._end);
std::swap(_begin, rhs._begin);
@@ -62,7 +60,7 @@ protected:
template <>
inline int32_t
-DocIdIterator<AttributePosting>::getData() const
+ArrayIterator<AttributePosting>::getData() const
{
return 1; // default weight 1 for single value attributes
}
@@ -74,11 +72,11 @@ DocIdIterator<AttributePosting>::getData() const
*/
template <typename P>
-class DocIdMinMaxIterator : public DocIdIterator<P>
+class DocIdMinMaxIterator : public ArrayIterator<P>
{
public:
DocIdMinMaxIterator()
- : DocIdIterator<P>()
+ : ArrayIterator<P>()
{ }
inline vespalib::btree::MinMaxAggregated getAggregated() const { return vespalib::btree::MinMaxAggregated(1, 1); }
};
diff --git a/searchlib/src/vespa/searchlib/attribute/attribute_blueprint_factory.cpp b/searchlib/src/vespa/searchlib/attribute/attribute_blueprint_factory.cpp
index 50c79ce4108..7cb69590d73 100644
--- a/searchlib/src/vespa/searchlib/attribute/attribute_blueprint_factory.cpp
+++ b/searchlib/src/vespa/searchlib/attribute/attribute_blueprint_factory.cpp
@@ -6,7 +6,7 @@
#include "attribute_weighted_set_blueprint.h"
#include "direct_weighted_set_blueprint.h"
#include "document_weight_or_filter_search.h"
-#include "i_document_weight_attribute.h"
+#include "i_direct_posting_store.h"
#include "iterator_pack.h"
#include "predicate_attribute.h"
#include <vespa/eval/eval/value.h>
@@ -100,7 +100,7 @@ using vespalib::stringref;
namespace search {
namespace {
-class NodeAsKey final : public IDocumentWeightAttribute::LookupKey {
+class NodeAsKey final : public IDirectPostingStore::LookupKey {
public:
NodeAsKey(const Node & node, vespalib::string & scratchPad)
: _node(node),
@@ -368,7 +368,7 @@ make_location_blueprint(const FieldSpec &field, const IAttributeVector &attribut
LocationPostFilterBlueprint::~LocationPostFilterBlueprint() = default;
-class LookupKey : public IDocumentWeightAttribute::LookupKey {
+class LookupKey : public IDirectPostingStore::LookupKey {
public:
LookupKey(MultiTerm & terms, uint32_t index) : _terms(terms), _index(index) {}
@@ -397,17 +397,17 @@ private:
class DirectWandBlueprint : public queryeval::ComplexLeafBlueprint
{
private:
- mutable queryeval::SharedWeakAndPriorityQueue _scores;
- const queryeval::wand::score_t _scoreThreshold;
- double _thresholdBoostFactor;
- const uint32_t _scoresAdjustFrequency;
- std::vector<int32_t> _weights;
- std::vector<IDocumentWeightAttribute::LookupResult> _terms;
- const IDocumentWeightAttribute &_attr;
- vespalib::datastore::EntryRef _dictionary_snapshot;
+ mutable queryeval::SharedWeakAndPriorityQueue _scores;
+ const queryeval::wand::score_t _scoreThreshold;
+ double _thresholdBoostFactor;
+ const uint32_t _scoresAdjustFrequency;
+ std::vector<int32_t> _weights;
+ std::vector<IDirectPostingStore::LookupResult> _terms;
+ const IDocidWithWeightPostingStore &_attr;
+ vespalib::datastore::EntryRef _dictionary_snapshot;
public:
- DirectWandBlueprint(const FieldSpec &field, const IDocumentWeightAttribute &attr, uint32_t scoresToTrack,
+ DirectWandBlueprint(const FieldSpec &field, const IDocidWithWeightPostingStore &attr, uint32_t scoresToTrack,
queryeval::wand::score_t scoreThreshold, double thresholdBoostFactor, size_t size_hint)
: ComplexLeafBlueprint(field),
_scores(scoresToTrack),
@@ -425,8 +425,8 @@ public:
~DirectWandBlueprint() override;
- void addTerm(const IDocumentWeightAttribute::LookupKey & key, int32_t weight, HitEstimate & estimate) {
- IDocumentWeightAttribute::LookupResult result = _attr.lookup(key, _dictionary_snapshot);
+ void addTerm(const IDirectPostingStore::LookupKey & key, int32_t weight, HitEstimate & estimate) {
+ IDirectPostingStore::LookupResult result = _attr.lookup(key, _dictionary_snapshot);
HitEstimate childEst(result.posting_size, (result.posting_size == 0));
if (!childEst.empty) {
if (estimate.empty) {
@@ -463,9 +463,9 @@ std::unique_ptr<SearchIterator>
DirectWandBlueprint::createFilterSearch(bool, FilterConstraint constraint) const
{
if (constraint == Blueprint::FilterConstraint::UPPER_BOUND) {
- std::vector<DocumentWeightIterator> iterators;
+ std::vector<DocidWithWeightIterator> iterators;
iterators.reserve(_terms.size());
- for (const IDocumentWeightAttribute::LookupResult &r : _terms) {
+ for (const IDirectPostingStore::LookupResult &r : _terms) {
_attr.create(r.posting_idx, iterators);
}
return attribute::DocumentWeightOrFilterSearch::create(std::move(iterators));
@@ -498,15 +498,15 @@ AttributeFieldBlueprint::getRange(vespalib::string &from, vespalib::string &to)
class DirectAttributeBlueprint : public queryeval::SimpleLeafBlueprint
{
private:
- const IAttributeVector &_iattr;
- const IDocumentWeightAttribute &_attr;
- vespalib::datastore::EntryRef _dictionary_snapshot;
- IDocumentWeightAttribute::LookupResult _dict_entry;
+ const IAttributeVector &_iattr;
+ const IDocidWithWeightPostingStore &_attr;
+ vespalib::datastore::EntryRef _dictionary_snapshot;
+ IDirectPostingStore::LookupResult _dict_entry;
public:
DirectAttributeBlueprint(const FieldSpec &field, const IAttributeVector &iattr,
- const IDocumentWeightAttribute &attr,
- const IDocumentWeightAttribute::LookupKey & key)
+ const IDocidWithWeightPostingStore &attr,
+ const IDirectPostingStore::LookupKey & key)
: SimpleLeafBlueprint(field),
_iattr(iattr),
_attr(attr),
@@ -547,7 +547,7 @@ public:
}
std::unique_ptr<queryeval::MatchingElementsSearch> create_matching_elements_search(const MatchingElementsFields &fields) const override {
if (fields.has_field(_iattr.getName())) {
- return queryeval::MatchingElementsSearch::create(_iattr, _dictionary_snapshot, vespalib::ConstArrayRef<IDocumentWeightAttribute::LookupResult>(&_dict_entry, 1));
+ return queryeval::MatchingElementsSearch::create(_iattr, _dictionary_snapshot, vespalib::ConstArrayRef<IDirectPostingStore::LookupResult>(&_dict_entry, 1));
} else {
return {};
}
@@ -574,7 +574,7 @@ class CreateBlueprintVisitor : public CreateBlueprintVisitorHelper
private:
const FieldSpec &_field;
const IAttributeVector &_attr;
- const IDocumentWeightAttribute *_dwa;
+ const IDocidWithWeightPostingStore *_dww;
vespalib::string _scratchPad;
public:
@@ -583,7 +583,7 @@ public:
: CreateBlueprintVisitorHelper(searchable, field, requestContext),
_field(field),
_attr(attr),
- _dwa(attr.asDocumentWeightAttribute()),
+ _dww(attr.as_docid_with_weight_posting_store()),
_scratchPad()
{
}
@@ -591,9 +591,9 @@ public:
template <class TermNode>
void visitSimpleTerm(TermNode &n) {
- if ((_dwa != nullptr) && !_field.isFilter() && n.isRanked() && !Term::isPossibleRangeTerm(n.getTerm())) {
+ if ((_dww != nullptr) && !_field.isFilter() && n.isRanked() && !Term::isPossibleRangeTerm(n.getTerm())) {
NodeAsKey key(n, _scratchPad);
- setResult(std::make_unique<DirectAttributeBlueprint>(_field, _attr, *_dwa, key));
+ setResult(std::make_unique<DirectAttributeBlueprint>(_field, _attr, *_dww, key));
} else {
visitTerm(n);
}
@@ -685,8 +685,8 @@ public:
}
setResult(std::move(ws));
} else {
- if (_dwa != nullptr) {
- auto *bp = new attribute::DirectWeightedSetBlueprint<queryeval::WeightedSetTermSearch>(_field, _attr, *_dwa, n.getNumTerms());
+ if (_dww != nullptr) {
+ auto *bp = new attribute::DirectWeightedSetBlueprint<queryeval::WeightedSetTermSearch>(_field, _attr, *_dww, n.getNumTerms());
createDirectWeightedSet(bp, n);
} else {
auto *bp = new WeightedSetTermBlueprint(_field);
@@ -696,8 +696,8 @@ public:
}
void visit(query::DotProduct &n) override {
- if (_dwa != nullptr) {
- auto *bp = new attribute::DirectWeightedSetBlueprint<queryeval::DotProductSearch>(_field, _attr, *_dwa, n.getNumTerms());
+ if (_dww != nullptr) {
+ auto *bp = new attribute::DirectWeightedSetBlueprint<queryeval::DotProductSearch>(_field, _attr, *_dww, n.getNumTerms());
createDirectWeightedSet(bp, n);
} else {
auto *bp = new DotProductBlueprint(_field);
@@ -706,8 +706,8 @@ public:
}
void visit(query::WandTerm &n) override {
- if (_dwa != nullptr) {
- auto *bp = new DirectWandBlueprint(_field, *_dwa,
+ if (_dww != nullptr) {
+ auto *bp = new DirectWandBlueprint(_field, *_dww,
n.getTargetNumHits(), n.getScoreThreshold(), n.getThresholdBoostFactor(),
n.getNumTerms());
createDirectWeightedSet(bp, n);
diff --git a/searchlib/src/vespa/searchlib/attribute/attributeiterators.h b/searchlib/src/vespa/searchlib/attribute/attributeiterators.h
index 584666cfdc5..9b00e9c13ce 100644
--- a/searchlib/src/vespa/searchlib/attribute/attributeiterators.h
+++ b/searchlib/src/vespa/searchlib/attribute/attributeiterators.h
@@ -2,7 +2,7 @@
#pragma once
-#include "dociditerator.h"
+#include "array_iterator.h"
#include "postinglisttraits.h"
#include <vespa/searchlib/queryeval/searchiterator.h>
#include <vespa/searchlib/fef/termfieldmatchdata.h>
diff --git a/searchlib/src/vespa/searchlib/attribute/attributeiterators.hpp b/searchlib/src/vespa/searchlib/attribute/attributeiterators.hpp
index 22a1f219040..feac1a966d5 100644
--- a/searchlib/src/vespa/searchlib/attribute/attributeiterators.hpp
+++ b/searchlib/src/vespa/searchlib/attribute/attributeiterators.hpp
@@ -115,7 +115,7 @@ namespace {
template <typename> struct is_tree_iterator;
template <typename P>
-struct is_tree_iterator<DocIdIterator<P>> {
+struct is_tree_iterator<ArrayIterator<P>> {
static constexpr bool value = false;
};
diff --git a/searchlib/src/vespa/searchlib/attribute/attributevector.cpp b/searchlib/src/vespa/searchlib/attribute/attributevector.cpp
index b3698981048..bbb5e4096fc 100644
--- a/searchlib/src/vespa/searchlib/attribute/attributevector.cpp
+++ b/searchlib/src/vespa/searchlib/attribute/attributevector.cpp
@@ -445,7 +445,7 @@ AttributeVector::set_reserved_doc_values()
attribute::IPostingListAttributeBase *AttributeVector::getIPostingListAttributeBase() { return nullptr; }
const attribute::IPostingListAttributeBase *AttributeVector::getIPostingListAttributeBase() const { return nullptr; }
-const IDocumentWeightAttribute * AttributeVector::asDocumentWeightAttribute() const { return nullptr; }
+const IDocidWithWeightPostingStore * AttributeVector::as_docid_with_weight_posting_store() const { return nullptr; }
const tensor::ITensorAttribute *AttributeVector::asTensorAttribute() const { return nullptr; }
const attribute::IMultiValueAttribute* AttributeVector::as_multi_value_attribute() const { return nullptr; }
bool AttributeVector::hasPostings() { return getIPostingListAttributeBase() != nullptr; }
diff --git a/searchlib/src/vespa/searchlib/attribute/attributevector.h b/searchlib/src/vespa/searchlib/attribute/attributevector.h
index 739fc2d3546..c6aa538ceac 100644
--- a/searchlib/src/vespa/searchlib/attribute/attributevector.h
+++ b/searchlib/src/vespa/searchlib/attribute/attributevector.h
@@ -47,7 +47,7 @@ namespace search {
class AttributeSaver;
class IEnumStore;
class IAttributeSaveTarget;
- struct IDocumentWeightAttribute;
+ class IDocidWithWeightPostingStore;
class QueryTermSimple;
class QueryTermUCS4;
@@ -384,8 +384,7 @@ public:
////// Search API
- // type-safe down-cast to attribute supporting direct document weight iterators
- const IDocumentWeightAttribute *asDocumentWeightAttribute() const override;
+ const IDocidWithWeightPostingStore *as_docid_with_weight_posting_store() const override;
const tensor::ITensorAttribute *asTensorAttribute() const override;
const attribute::IMultiValueAttribute* as_multi_value_attribute() const override;
diff --git a/searchlib/src/vespa/searchlib/attribute/direct_weighted_set_blueprint.h b/searchlib/src/vespa/searchlib/attribute/direct_weighted_set_blueprint.h
index e50c7688ac7..30bdfc24998 100644
--- a/searchlib/src/vespa/searchlib/attribute/direct_weighted_set_blueprint.h
+++ b/searchlib/src/vespa/searchlib/attribute/direct_weighted_set_blueprint.h
@@ -3,7 +3,7 @@
#pragma once
#include "attribute_object_visitor.h"
-#include "i_document_weight_attribute.h"
+#include "i_docid_with_weight_posting_store.h"
#include <vespa/searchcommon/attribute/iattributevector.h>
#include <vespa/searchlib/common/matching_elements_fields.h>
#include <vespa/searchlib/fef/termfieldmatchdataarray.h>
@@ -17,7 +17,7 @@ namespace search::attribute {
/**
* Blueprint used for WeightedSetTerm or DotProduct over a multi-value attribute
- * which supports the IDocumentWeightAttribute interface.
+ * which supports the IDirectPostingStore interface.
*
* This allows access to low-level posting lists, which speeds up query execution.
*/
@@ -25,18 +25,18 @@ template <typename SearchType>
class DirectWeightedSetBlueprint : public queryeval::ComplexLeafBlueprint
{
private:
- std::vector<int32_t> _weights;
- std::vector<IDocumentWeightAttribute::LookupResult> _terms;
- const IAttributeVector &_iattr;
- const IDocumentWeightAttribute &_attr;
- vespalib::datastore::EntryRef _dictionary_snapshot;
+ std::vector<int32_t> _weights;
+ std::vector<IDirectPostingStore::LookupResult> _terms;
+ const IAttributeVector &_iattr;
+ const IDocidWithWeightPostingStore &_attr;
+ vespalib::datastore::EntryRef _dictionary_snapshot;
public:
- DirectWeightedSetBlueprint(const queryeval::FieldSpec &field, const IAttributeVector &iattr, const IDocumentWeightAttribute &attr, size_t size_hint);
+ DirectWeightedSetBlueprint(const queryeval::FieldSpec &field, const IAttributeVector &iattr, const IDocidWithWeightPostingStore &attr, size_t size_hint);
~DirectWeightedSetBlueprint() override;
- void addTerm(const IDocumentWeightAttribute::LookupKey & key, int32_t weight, HitEstimate & estimate) {
- IDocumentWeightAttribute::LookupResult result = _attr.lookup(key, _dictionary_snapshot);
+ void addTerm(const IDirectPostingStore::LookupKey & key, int32_t weight, HitEstimate & estimate) {
+ IDirectPostingStore::LookupResult result = _attr.lookup(key, _dictionary_snapshot);
HitEstimate childEst(result.posting_size, (result.posting_size == 0));
if (!childEst.empty) {
if (estimate.empty) {
@@ -57,7 +57,7 @@ public:
std::unique_ptr<queryeval::SearchIterator> createFilterSearch(bool strict, FilterConstraint constraint) const override;
std::unique_ptr<queryeval::MatchingElementsSearch> create_matching_elements_search(const MatchingElementsFields &fields) const override {
if (fields.has_field(_iattr.getName())) {
- return queryeval::MatchingElementsSearch::create(_iattr, _dictionary_snapshot, vespalib::ConstArrayRef<IDocumentWeightAttribute::LookupResult>(_terms));
+ return queryeval::MatchingElementsSearch::create(_iattr, _dictionary_snapshot, vespalib::ConstArrayRef<IDirectPostingStore::LookupResult>(_terms));
} else {
return {};
}
diff --git a/searchlib/src/vespa/searchlib/attribute/direct_weighted_set_blueprint.hpp b/searchlib/src/vespa/searchlib/attribute/direct_weighted_set_blueprint.hpp
index bf6410c347c..4e754780d54 100644
--- a/searchlib/src/vespa/searchlib/attribute/direct_weighted_set_blueprint.hpp
+++ b/searchlib/src/vespa/searchlib/attribute/direct_weighted_set_blueprint.hpp
@@ -13,7 +13,7 @@ namespace search::attribute {
template <typename SearchType>
DirectWeightedSetBlueprint<SearchType>::DirectWeightedSetBlueprint(const queryeval::FieldSpec &field,
const IAttributeVector &iattr,
- const IDocumentWeightAttribute &attr,
+ const IDocidWithWeightPostingStore &attr,
size_t size_hint)
: ComplexLeafBlueprint(field),
_weights(),
@@ -39,10 +39,10 @@ DirectWeightedSetBlueprint<SearchType>::createLeafSearch(const fef::TermFieldMat
if (_terms.empty()) {
return std::make_unique<queryeval::EmptySearch>();
}
- std::vector<DocumentWeightIterator> iterators;
+ std::vector<DocidWithWeightIterator> iterators;
const size_t numChildren = _terms.size();
iterators.reserve(numChildren);
- for (const IDocumentWeightAttribute::LookupResult &r : _terms) {
+ for (const IDirectPostingStore::LookupResult &r : _terms) {
_attr.create(r.posting_idx, iterators);
}
bool field_is_filter = getState().fields()[0].isFilter();
@@ -56,9 +56,9 @@ template <typename SearchType>
std::unique_ptr<queryeval::SearchIterator>
DirectWeightedSetBlueprint<SearchType>::createFilterSearch(bool, FilterConstraint) const
{
- std::vector<DocumentWeightIterator> iterators;
+ std::vector<DocidWithWeightIterator> iterators;
iterators.reserve(_terms.size());
- for (const IDocumentWeightAttribute::LookupResult &r : _terms) {
+ for (const IDirectPostingStore::LookupResult &r : _terms) {
_attr.create(r.posting_idx, iterators);
}
return attribute::DocumentWeightOrFilterSearch::create(std::move(iterators));
diff --git a/searchlib/src/vespa/searchlib/attribute/document_weight_or_filter_search.cpp b/searchlib/src/vespa/searchlib/attribute/document_weight_or_filter_search.cpp
index ff2fe43d941..7ae7a24b80f 100644
--- a/searchlib/src/vespa/searchlib/attribute/document_weight_or_filter_search.cpp
+++ b/searchlib/src/vespa/searchlib/attribute/document_weight_or_filter_search.cpp
@@ -86,7 +86,7 @@ DocumentWeightOrFilterSearchImpl<IteratorPack>::doSeek(uint32_t docId)
}
std::unique_ptr<queryeval::SearchIterator>
-DocumentWeightOrFilterSearch::create(std::vector<DocumentWeightIterator>&& children)
+DocumentWeightOrFilterSearch::create(std::vector<DocidWithWeightIterator>&& children)
{
if (children.empty()) {
return std::make_unique<queryeval::EmptySearch>();
diff --git a/searchlib/src/vespa/searchlib/attribute/document_weight_or_filter_search.h b/searchlib/src/vespa/searchlib/attribute/document_weight_or_filter_search.h
index e56ccf2dcc5..cea30e83619 100644
--- a/searchlib/src/vespa/searchlib/attribute/document_weight_or_filter_search.h
+++ b/searchlib/src/vespa/searchlib/attribute/document_weight_or_filter_search.h
@@ -1,6 +1,6 @@
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include "i_document_weight_attribute.h"
+#include "i_direct_posting_store.h"
#include <vespa/searchlib/queryeval/searchiterator.h>
namespace search::fef { class MatchData; }
@@ -15,7 +15,7 @@ class DocumentWeightOrFilterSearch : public queryeval::SearchIterator
protected:
DocumentWeightOrFilterSearch() = default;
public:
- static std::unique_ptr<SearchIterator> create(std::vector<DocumentWeightIterator>&& children);
+ static std::unique_ptr<SearchIterator> create(std::vector<DocidWithWeightIterator>&& children);
static std::unique_ptr<SearchIterator> create(const std::vector<SearchIterator *>& children,
std::unique_ptr<fef::MatchData> md);
};
diff --git a/searchlib/src/vespa/searchlib/attribute/i_document_weight_attribute.cpp b/searchlib/src/vespa/searchlib/attribute/i_direct_posting_store.cpp
index 73ae255cb20..8d17ac9e8ba 100644
--- a/searchlib/src/vespa/searchlib/attribute/i_document_weight_attribute.cpp
+++ b/searchlib/src/vespa/searchlib/attribute/i_direct_posting_store.cpp
@@ -1,11 +1,11 @@
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include "i_document_weight_attribute.h"
+#include "i_direct_posting_store.h"
#include <charconv>
namespace search {
namespace {
-class StringAsKey final : public IDocumentWeightAttribute::LookupKey {
+class StringAsKey final : public IDirectPostingStore::LookupKey {
public:
StringAsKey(vespalib::stringref key)
: _key(key)
@@ -18,15 +18,15 @@ private:
}
bool
-IDocumentWeightAttribute::LookupKey::asInteger(int64_t &value) const {
+IDirectPostingStore::LookupKey::asInteger(int64_t &value) const {
vespalib::stringref str = asString();
const char *end = str.data() + str.size();
auto res = std::from_chars(str.data(), end, value);
return res.ptr == end;
}
-IDocumentWeightAttribute::LookupResult
-IDocumentWeightAttribute::lookup(vespalib::stringref term, vespalib::datastore::EntryRef dictionary_snapshot) const {
+IDirectPostingStore::LookupResult
+IDirectPostingStore::lookup(vespalib::stringref term, vespalib::datastore::EntryRef dictionary_snapshot) const {
return lookup(StringAsKey(term), dictionary_snapshot);
}
}
diff --git a/searchlib/src/vespa/searchlib/attribute/i_document_weight_attribute.h b/searchlib/src/vespa/searchlib/attribute/i_direct_posting_store.h
index 8f819cbef3b..1d26f3ef202 100644
--- a/searchlib/src/vespa/searchlib/attribute/i_document_weight_attribute.h
+++ b/searchlib/src/vespa/searchlib/attribute/i_direct_posting_store.h
@@ -10,10 +10,15 @@ namespace search::queryeval { class SearchIterator; }
namespace search {
-using DocumentWeightIterator = attribute::PostingListTraits<int32_t>::const_iterator;
-
-struct IDocumentWeightAttribute
-{
+using DocidWithWeightIterator = attribute::PostingListTraits<int32_t>::const_iterator;
+
+/**
+ * Baseline interface providing access to dictionary lookups and underlying posting lists for an attribute vector.
+ *
+ * This is used to speedup query execution for multi-term query operators as InTerm, WeightedSetTerm, DotProduct, Wand.
+ */
+class IDirectPostingStore {
+public:
struct LookupKey {
virtual ~LookupKey() = default;
// It is required that the string is zero terminated
@@ -41,11 +46,9 @@ struct IDocumentWeightAttribute
* (e.g. lowercased) value equals the folded value for enum_idx.
*/
virtual void collect_folded(vespalib::datastore::EntryRef enum_idx, vespalib::datastore::EntryRef dictionary_snapshot, const std::function<void(vespalib::datastore::EntryRef)>& callback) const = 0;
- virtual void create(vespalib::datastore::EntryRef idx, std::vector<DocumentWeightIterator> &dst) const = 0;
- virtual DocumentWeightIterator create(vespalib::datastore::EntryRef idx) const = 0;
virtual bool has_weight_iterator(vespalib::datastore::EntryRef idx) const noexcept = 0;
virtual std::unique_ptr<queryeval::SearchIterator> make_bitvector_iterator(vespalib::datastore::EntryRef idx, uint32_t doc_id_limit, fef::TermFieldMatchData &match_data, bool strict) const = 0;
- virtual ~IDocumentWeightAttribute() = default;
+ virtual ~IDirectPostingStore() = default;
};
}
diff --git a/searchlib/src/vespa/searchlib/attribute/i_docid_with_weight_posting_store.h b/searchlib/src/vespa/searchlib/attribute/i_docid_with_weight_posting_store.h
new file mode 100644
index 00000000000..ae2ff2f3177
--- /dev/null
+++ b/searchlib/src/vespa/searchlib/attribute/i_docid_with_weight_posting_store.h
@@ -0,0 +1,21 @@
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+
+#pragma once
+
+#include "i_direct_posting_store.h"
+
+namespace search {
+
+/**
+ * Interface providing access to dictionary lookups and underlying posting lists that contains {docid, weight} tuples.
+ *
+ * This posting store type is supported by multi-value attributes with fast-search.
+ */
+class IDocidWithWeightPostingStore : public IDirectPostingStore {
+public:
+ virtual void create(vespalib::datastore::EntryRef idx, std::vector<DocidWithWeightIterator> &dst) const = 0;
+ virtual DocidWithWeightIterator create(vespalib::datastore::EntryRef idx) const = 0;
+};
+
+}
+
diff --git a/searchlib/src/vespa/searchlib/attribute/imported_attribute_vector_read_guard.cpp b/searchlib/src/vespa/searchlib/attribute/imported_attribute_vector_read_guard.cpp
index 04f5d4b92d8..bdec9d1d7e2 100644
--- a/searchlib/src/vespa/searchlib/attribute/imported_attribute_vector_read_guard.cpp
+++ b/searchlib/src/vespa/searchlib/attribute/imported_attribute_vector_read_guard.cpp
@@ -117,7 +117,7 @@ std::unique_ptr<ISearchContext> ImportedAttributeVectorReadGuard::createSearchCo
return std::make_unique<ImportedSearchContext>(std::move(term), params, _imported_attribute, _target_attribute);
}
-const IDocumentWeightAttribute *ImportedAttributeVectorReadGuard::asDocumentWeightAttribute() const {
+const IDocidWithWeightPostingStore *ImportedAttributeVectorReadGuard::as_docid_with_weight_posting_store() const {
return nullptr;
}
diff --git a/searchlib/src/vespa/searchlib/attribute/imported_attribute_vector_read_guard.h b/searchlib/src/vespa/searchlib/attribute/imported_attribute_vector_read_guard.h
index a53f95677ac..643e2352668 100644
--- a/searchlib/src/vespa/searchlib/attribute/imported_attribute_vector_read_guard.h
+++ b/searchlib/src/vespa/searchlib/attribute/imported_attribute_vector_read_guard.h
@@ -59,7 +59,7 @@ public:
const char * getStringFromEnum(EnumHandle e) const override;
std::unique_ptr<ISearchContext> createSearchContext(std::unique_ptr<QueryTermSimple> term,
const SearchContextParams &params) const override;
- const IDocumentWeightAttribute *asDocumentWeightAttribute() const override;
+ const IDocidWithWeightPostingStore *as_docid_with_weight_posting_store() const override;
const tensor::ITensorAttribute *asTensorAttribute() const override;
const attribute::IMultiValueAttribute* as_multi_value_attribute() const override;
BasicType::Type getBasicType() const override;
diff --git a/searchlib/src/vespa/searchlib/attribute/imported_search_context.cpp b/searchlib/src/vespa/searchlib/attribute/imported_search_context.cpp
index 80732b5813c..b49ec1bfc9e 100644
--- a/searchlib/src/vespa/searchlib/attribute/imported_search_context.cpp
+++ b/searchlib/src/vespa/searchlib/attribute/imported_search_context.cpp
@@ -128,7 +128,7 @@ ImportedSearchContext::createIterator(fef::TermFieldMatchData* matchData, bool s
return SearchIterator::UP(new EmptySearch());
} else {
using Posting = vespalib::btree::BTreeKeyData<uint32_t, int32_t>;
- using DocIt = DocIdIterator<Posting>;
+ using DocIt = ArrayIterator<Posting>;
DocIt postings;
auto array = _merger.getArray();
postings.set(&array[0], &array[array.size()]);
diff --git a/searchlib/src/vespa/searchlib/attribute/iterator_pack.cpp b/searchlib/src/vespa/searchlib/attribute/iterator_pack.cpp
index 3dda6017e0a..7f40a38fc7f 100644
--- a/searchlib/src/vespa/searchlib/attribute/iterator_pack.cpp
+++ b/searchlib/src/vespa/searchlib/attribute/iterator_pack.cpp
@@ -8,7 +8,7 @@ namespace search {
AttributeIteratorPack::~AttributeIteratorPack() = default;
-AttributeIteratorPack::AttributeIteratorPack(std::vector<DocumentWeightIterator> &&children)
+AttributeIteratorPack::AttributeIteratorPack(std::vector<DocidWithWeightIterator> &&children)
: _children(std::move(children))
{
assert(_children.size() <= std::numeric_limits<ref_t>::max());
diff --git a/searchlib/src/vespa/searchlib/attribute/iterator_pack.h b/searchlib/src/vespa/searchlib/attribute/iterator_pack.h
index 04df7c9b772..3d2bedc7b3a 100644
--- a/searchlib/src/vespa/searchlib/attribute/iterator_pack.h
+++ b/searchlib/src/vespa/searchlib/attribute/iterator_pack.h
@@ -2,7 +2,7 @@
#pragma once
-#include "i_document_weight_attribute.h"
+#include "i_direct_posting_store.h"
#include <vespa/searchlib/queryeval/begin_and_end_id.h>
namespace search {
@@ -12,7 +12,7 @@ class BitVector;
class AttributeIteratorPack
{
private:
- std::vector<DocumentWeightIterator> _children;
+ std::vector<DocidWithWeightIterator> _children;
public:
using ref_t = uint16_t;
@@ -20,7 +20,7 @@ public:
AttributeIteratorPack(AttributeIteratorPack &&rhs) noexcept = default;
AttributeIteratorPack &operator=(AttributeIteratorPack &&rhs) noexcept = default;
- explicit AttributeIteratorPack(std::vector<DocumentWeightIterator> &&children);
+ explicit AttributeIteratorPack(std::vector<DocidWithWeightIterator> &&children);
~AttributeIteratorPack();
uint32_t get_docid(ref_t ref) const {
diff --git a/searchlib/src/vespa/searchlib/attribute/multinumericpostattribute.h b/searchlib/src/vespa/searchlib/attribute/multinumericpostattribute.h
index 2d0b8cbd733..2775f8e4947 100644
--- a/searchlib/src/vespa/searchlib/attribute/multinumericpostattribute.h
+++ b/searchlib/src/vespa/searchlib/attribute/multinumericpostattribute.h
@@ -4,7 +4,7 @@
#include "multinumericenumattribute.h"
#include "postinglistattribute.h"
-#include "i_document_weight_attribute.h"
+#include "i_docid_with_weight_posting_store.h"
namespace search {
@@ -32,18 +32,19 @@ public:
using EnumStoreBatchUpdater = typename EnumStore::BatchUpdater;
private:
- struct DocumentWeightAttributeAdapter final : IDocumentWeightAttribute {
+ class DocidWithWeightPostingStoreAdapter final : public IDocidWithWeightPostingStore {
+ public:
const MultiValueNumericPostingAttribute &self;
- DocumentWeightAttributeAdapter(const MultiValueNumericPostingAttribute &self_in) : self(self_in) {}
+ DocidWithWeightPostingStoreAdapter(const MultiValueNumericPostingAttribute &self_in) : self(self_in) {}
vespalib::datastore::EntryRef get_dictionary_snapshot() const override;
LookupResult lookup(const LookupKey & key, vespalib::datastore::EntryRef dictionary_snapshot) const override;
void collect_folded(vespalib::datastore::EntryRef enum_idx, vespalib::datastore::EntryRef dictionary_snapshot, const std::function<void(vespalib::datastore::EntryRef)>& callback) const override;
- void create(vespalib::datastore::EntryRef idx, std::vector<DocumentWeightIterator> &dst) const override;
- DocumentWeightIterator create(vespalib::datastore::EntryRef idx) const override;
+ void create(vespalib::datastore::EntryRef idx, std::vector<DocidWithWeightIterator> &dst) const override;
+ DocidWithWeightIterator create(vespalib::datastore::EntryRef idx) const override;
std::unique_ptr<queryeval::SearchIterator> make_bitvector_iterator(vespalib::datastore::EntryRef idx, uint32_t doc_id_limit, fef::TermFieldMatchData &match_data, bool strict) const override;
bool has_weight_iterator(vespalib::datastore::EntryRef idx) const noexcept override;
};
- DocumentWeightAttributeAdapter _document_weight_attribute_adapter;
+ DocidWithWeightPostingStoreAdapter _posting_store_adapter;
friend class PostingListAttributeTest;
template <typename, typename, typename>
@@ -87,7 +88,7 @@ public:
std::unique_ptr<attribute::SearchContext>
getSearch(QueryTermSimpleUP term, const attribute::SearchContextParams & params) const override;
- const IDocumentWeightAttribute *asDocumentWeightAttribute() const override;
+ const IDocidWithWeightPostingStore *as_docid_with_weight_posting_store() const override;
bool onAddDoc(DocId doc) override {
return forwardedOnAddDoc(doc, this->_mvMapping.getNumKeys(), this->_mvMapping.getCapacityKeys());
diff --git a/searchlib/src/vespa/searchlib/attribute/multinumericpostattribute.hpp b/searchlib/src/vespa/searchlib/attribute/multinumericpostattribute.hpp
index 53c183a6987..b0ca9f7658f 100644
--- a/searchlib/src/vespa/searchlib/attribute/multinumericpostattribute.hpp
+++ b/searchlib/src/vespa/searchlib/attribute/multinumericpostattribute.hpp
@@ -43,7 +43,7 @@ MultiValueNumericPostingAttribute<B, M>::MultiValueNumericPostingAttribute(const
const AttributeVector::Config & cfg)
: MultiValueNumericEnumAttribute<B, M>(name, cfg),
PostingParent(*this, this->getEnumStore()),
- _document_weight_attribute_adapter(*this)
+ _posting_store_adapter(*this)
{
}
@@ -86,15 +86,15 @@ MultiValueNumericPostingAttribute<B, M>::getSearch(QueryTermSimpleUP qTerm,
template <typename B, typename M>
vespalib::datastore::EntryRef
-MultiValueNumericPostingAttribute<B, M>::DocumentWeightAttributeAdapter::get_dictionary_snapshot() const
+MultiValueNumericPostingAttribute<B, M>::DocidWithWeightPostingStoreAdapter::get_dictionary_snapshot() const
{
const IEnumStoreDictionary& dictionary = self._enumStore.get_dictionary();
return dictionary.get_frozen_root();
}
template <typename B, typename M>
-IDocumentWeightAttribute::LookupResult
-MultiValueNumericPostingAttribute<B, M>::DocumentWeightAttributeAdapter::lookup(const LookupKey & key, vespalib::datastore::EntryRef dictionary_snapshot) const
+IDirectPostingStore::LookupResult
+MultiValueNumericPostingAttribute<B, M>::DocidWithWeightPostingStoreAdapter::lookup(const LookupKey & key, vespalib::datastore::EntryRef dictionary_snapshot) const
{
const IEnumStoreDictionary& dictionary = self._enumStore.get_dictionary();
int64_t int_term;
@@ -116,7 +116,7 @@ MultiValueNumericPostingAttribute<B, M>::DocumentWeightAttributeAdapter::lookup(
template <typename B, typename M>
void
-MultiValueNumericPostingAttribute<B, M>::DocumentWeightAttributeAdapter::collect_folded(vespalib::datastore::EntryRef enum_idx, vespalib::datastore::EntryRef dictionary_snapshot, const std::function<void(vespalib::datastore::EntryRef)>& callback)const
+MultiValueNumericPostingAttribute<B, M>::DocidWithWeightPostingStoreAdapter::collect_folded(vespalib::datastore::EntryRef enum_idx, vespalib::datastore::EntryRef dictionary_snapshot, const std::function<void(vespalib::datastore::EntryRef)>& callback)const
{
(void) dictionary_snapshot;
callback(enum_idx);
@@ -124,15 +124,15 @@ MultiValueNumericPostingAttribute<B, M>::DocumentWeightAttributeAdapter::collect
template <typename B, typename M>
void
-MultiValueNumericPostingAttribute<B, M>::DocumentWeightAttributeAdapter::create(vespalib::datastore::EntryRef idx, std::vector<DocumentWeightIterator> &dst) const
+MultiValueNumericPostingAttribute<B, M>::DocidWithWeightPostingStoreAdapter::create(vespalib::datastore::EntryRef idx, std::vector<DocidWithWeightIterator> &dst) const
{
assert(idx.valid());
self.get_posting_store().beginFrozen(idx, dst);
}
template <typename B, typename M>
-DocumentWeightIterator
-MultiValueNumericPostingAttribute<B, M>::DocumentWeightAttributeAdapter::create(vespalib::datastore::EntryRef idx) const
+DocidWithWeightIterator
+MultiValueNumericPostingAttribute<B, M>::DocidWithWeightPostingStoreAdapter::create(vespalib::datastore::EntryRef idx) const
{
assert(idx.valid());
return self.get_posting_store().beginFrozen(idx);
@@ -140,27 +140,27 @@ MultiValueNumericPostingAttribute<B, M>::DocumentWeightAttributeAdapter::create(
template <typename B, typename M>
std::unique_ptr<queryeval::SearchIterator>
-MultiValueNumericPostingAttribute<B, M>::DocumentWeightAttributeAdapter::make_bitvector_iterator(vespalib::datastore::EntryRef idx, uint32_t doc_id_limit, fef::TermFieldMatchData &match_data, bool strict) const
+MultiValueNumericPostingAttribute<B, M>::DocidWithWeightPostingStoreAdapter::make_bitvector_iterator(vespalib::datastore::EntryRef idx, uint32_t doc_id_limit, fef::TermFieldMatchData &match_data, bool strict) const
{
return self.get_posting_store().make_bitvector_iterator(idx, doc_id_limit, match_data, strict);
}
template <typename B, typename M>
bool
-MultiValueNumericPostingAttribute<B, M>::DocumentWeightAttributeAdapter::has_weight_iterator(vespalib::datastore::EntryRef idx) const noexcept
+MultiValueNumericPostingAttribute<B, M>::DocidWithWeightPostingStoreAdapter::has_weight_iterator(vespalib::datastore::EntryRef idx) const noexcept
{
return self.get_posting_store().has_btree(idx);
}
template <typename B, typename M>
-const IDocumentWeightAttribute *
-MultiValueNumericPostingAttribute<B, M>::asDocumentWeightAttribute() const
+const IDocidWithWeightPostingStore*
+MultiValueNumericPostingAttribute<B, M>::as_docid_with_weight_posting_store() const
{
if (this->hasWeightedSetType() && (this->getBasicType() == AttributeVector::BasicType::INT64) && !this->getIsFilter()) {
- return &_document_weight_attribute_adapter;
+ return &_posting_store_adapter;
}
return nullptr;
}
-} // namespace search
+}
diff --git a/searchlib/src/vespa/searchlib/attribute/multistringpostattribute.h b/searchlib/src/vespa/searchlib/attribute/multistringpostattribute.h
index 67f4f25ac5b..bd7cb7b5497 100644
--- a/searchlib/src/vespa/searchlib/attribute/multistringpostattribute.h
+++ b/searchlib/src/vespa/searchlib/attribute/multistringpostattribute.h
@@ -4,7 +4,7 @@
#include "multistringattribute.h"
#include "postinglistattribute.h"
-#include "i_document_weight_attribute.h"
+#include "i_docid_with_weight_posting_store.h"
namespace search {
@@ -30,18 +30,19 @@ public:
using EnumStoreBatchUpdater = typename EnumStore::BatchUpdater;
private:
- struct DocumentWeightAttributeAdapter final : IDocumentWeightAttribute {
+ class DocidWithWeightPostingStoreAdapter final : public IDocidWithWeightPostingStore {
+ public:
const MultiValueStringPostingAttributeT &self;
- DocumentWeightAttributeAdapter(const MultiValueStringPostingAttributeT &self_in) : self(self_in) {}
+ DocidWithWeightPostingStoreAdapter(const MultiValueStringPostingAttributeT &self_in) : self(self_in) {}
vespalib::datastore::EntryRef get_dictionary_snapshot() const override;
LookupResult lookup(const LookupKey & key, vespalib::datastore::EntryRef dictionary_snapshot) const override;
void collect_folded(vespalib::datastore::EntryRef enum_idx, vespalib::datastore::EntryRef dictionary_snapshot, const std::function<void(vespalib::datastore::EntryRef)>& callback) const override;
- void create(vespalib::datastore::EntryRef idx, std::vector<DocumentWeightIterator> &dst) const override;
- DocumentWeightIterator create(vespalib::datastore::EntryRef idx) const override;
+ void create(vespalib::datastore::EntryRef idx, std::vector<DocidWithWeightIterator> &dst) const override;
+ DocidWithWeightIterator create(vespalib::datastore::EntryRef idx) const override;
std::unique_ptr<queryeval::SearchIterator> make_bitvector_iterator(vespalib::datastore::EntryRef idx, uint32_t doc_id_limit, fef::TermFieldMatchData &match_data, bool strict) const override;
bool has_weight_iterator(vespalib::datastore::EntryRef idx) const noexcept override;
};
- DocumentWeightAttributeAdapter _document_weight_attribute_adapter;
+ DocidWithWeightPostingStoreAdapter _posting_store_adapter;
using LoadedVector = typename B::LoadedVector;
using PostingParent = PostingListAttributeSubBase<AttributeWeightPosting,
@@ -84,7 +85,7 @@ public:
std::unique_ptr<attribute::SearchContext>
getSearch(QueryTermSimpleUP term, const attribute::SearchContextParams & params) const override;
- const IDocumentWeightAttribute *asDocumentWeightAttribute() const override;
+ const IDocidWithWeightPostingStore *as_docid_with_weight_posting_store() const override;
bool onAddDoc(DocId doc) override {
return forwardedOnAddDoc(doc, this->_mvMapping.getNumKeys(), this->_mvMapping.getCapacityKeys());
diff --git a/searchlib/src/vespa/searchlib/attribute/multistringpostattribute.hpp b/searchlib/src/vespa/searchlib/attribute/multistringpostattribute.hpp
index 5d4f140b96c..a6d967d1646 100644
--- a/searchlib/src/vespa/searchlib/attribute/multistringpostattribute.hpp
+++ b/searchlib/src/vespa/searchlib/attribute/multistringpostattribute.hpp
@@ -13,7 +13,7 @@ template <typename B, typename T>
MultiValueStringPostingAttributeT<B, T>::MultiValueStringPostingAttributeT(const vespalib::string & name, const AttributeVector::Config & c)
: MultiValueStringAttributeT<B, T>(name, c),
PostingParent(*this, this->getEnumStore()),
- _document_weight_attribute_adapter(*this)
+ _posting_store_adapter(*this)
{
}
@@ -106,15 +106,15 @@ MultiValueStringPostingAttributeT<B, T>::getSearch(QueryTermSimpleUP qTerm,
template <typename B, typename T>
vespalib::datastore::EntryRef
-MultiValueStringPostingAttributeT<B, T>::DocumentWeightAttributeAdapter::get_dictionary_snapshot() const
+MultiValueStringPostingAttributeT<B, T>::DocidWithWeightPostingStoreAdapter::get_dictionary_snapshot() const
{
const IEnumStoreDictionary& dictionary = self._enumStore.get_dictionary();
return dictionary.get_frozen_root();
}
template <typename B, typename T>
-IDocumentWeightAttribute::LookupResult
-MultiValueStringPostingAttributeT<B, T>::DocumentWeightAttributeAdapter::lookup(const LookupKey & key, vespalib::datastore::EntryRef dictionary_snapshot) const
+IDirectPostingStore::LookupResult
+MultiValueStringPostingAttributeT<B, T>::DocidWithWeightPostingStoreAdapter::lookup(const LookupKey & key, vespalib::datastore::EntryRef dictionary_snapshot) const
{
const IEnumStoreDictionary& dictionary = self._enumStore.get_dictionary();
vespalib::stringref keyAsString = key.asString();
@@ -136,7 +136,7 @@ MultiValueStringPostingAttributeT<B, T>::DocumentWeightAttributeAdapter::lookup(
template <typename B, typename T>
void
-MultiValueStringPostingAttributeT<B, T>::DocumentWeightAttributeAdapter::collect_folded(vespalib::datastore::EntryRef enum_idx, vespalib::datastore::EntryRef dictionary_snapshot, const std::function<void(vespalib::datastore::EntryRef)>& callback) const
+MultiValueStringPostingAttributeT<B, T>::DocidWithWeightPostingStoreAdapter::collect_folded(vespalib::datastore::EntryRef enum_idx, vespalib::datastore::EntryRef dictionary_snapshot, const std::function<void(vespalib::datastore::EntryRef)>& callback) const
{
const IEnumStoreDictionary &dictionary = self._enumStore.get_dictionary();
dictionary.collect_folded(enum_idx, dictionary_snapshot, callback);
@@ -144,15 +144,15 @@ MultiValueStringPostingAttributeT<B, T>::DocumentWeightAttributeAdapter::collect
template <typename B, typename T>
void
-MultiValueStringPostingAttributeT<B, T>::DocumentWeightAttributeAdapter::create(vespalib::datastore::EntryRef idx, std::vector<DocumentWeightIterator> &dst) const
+MultiValueStringPostingAttributeT<B, T>::DocidWithWeightPostingStoreAdapter::create(vespalib::datastore::EntryRef idx, std::vector<DocidWithWeightIterator> &dst) const
{
assert(idx.valid());
self.get_posting_store().beginFrozen(idx, dst);
}
template <typename B, typename M>
-DocumentWeightIterator
-MultiValueStringPostingAttributeT<B, M>::DocumentWeightAttributeAdapter::create(vespalib::datastore::EntryRef idx) const
+DocidWithWeightIterator
+MultiValueStringPostingAttributeT<B, M>::DocidWithWeightPostingStoreAdapter::create(vespalib::datastore::EntryRef idx) const
{
assert(idx.valid());
return self.get_posting_store().beginFrozen(idx);
@@ -160,28 +160,28 @@ MultiValueStringPostingAttributeT<B, M>::DocumentWeightAttributeAdapter::create(
template <typename B, typename M>
bool
-MultiValueStringPostingAttributeT<B, M>::DocumentWeightAttributeAdapter::has_weight_iterator(vespalib::datastore::EntryRef idx) const noexcept
+MultiValueStringPostingAttributeT<B, M>::DocidWithWeightPostingStoreAdapter::has_weight_iterator(vespalib::datastore::EntryRef idx) const noexcept
{
return self.get_posting_store().has_btree(idx);
}
template <typename B, typename M>
std::unique_ptr<queryeval::SearchIterator>
-MultiValueStringPostingAttributeT<B, M>::DocumentWeightAttributeAdapter::make_bitvector_iterator(vespalib::datastore::EntryRef idx, uint32_t doc_id_limit, fef::TermFieldMatchData &match_data, bool strict) const
+MultiValueStringPostingAttributeT<B, M>::DocidWithWeightPostingStoreAdapter::make_bitvector_iterator(vespalib::datastore::EntryRef idx, uint32_t doc_id_limit, fef::TermFieldMatchData &match_data, bool strict) const
{
return self.get_posting_store().make_bitvector_iterator(idx, doc_id_limit, match_data, strict);
}
template <typename B, typename T>
-const IDocumentWeightAttribute *
-MultiValueStringPostingAttributeT<B, T>::asDocumentWeightAttribute() const
+const IDocidWithWeightPostingStore*
+MultiValueStringPostingAttributeT<B, T>::as_docid_with_weight_posting_store() const
{
// TODO: Add support for handling bit vectors too, and lift restriction on isFilter.
if (this->hasWeightedSetType() && this->isStringType() && ! this->getIsFilter()) {
- return &_document_weight_attribute_adapter;
+ return &_posting_store_adapter;
}
return nullptr;
}
-} // namespace search
+}
diff --git a/searchlib/src/vespa/searchlib/attribute/postinglistattribute.h b/searchlib/src/vespa/searchlib/attribute/postinglistattribute.h
index e2be0d69434..41fdff96790 100644
--- a/searchlib/src/vespa/searchlib/attribute/postinglistattribute.h
+++ b/searchlib/src/vespa/searchlib/attribute/postinglistattribute.h
@@ -2,7 +2,7 @@
#pragma once
-#include "dociditerator.h"
+#include "array_iterator.h"
#include "enumattribute.h"
#include "ipostinglistattributebase.h"
#include "numericbase.h"
diff --git a/searchlib/src/vespa/searchlib/attribute/postinglistsearchcontext.hpp b/searchlib/src/vespa/searchlib/attribute/postinglistsearchcontext.hpp
index 27ef06565a6..4436ea203ce 100644
--- a/searchlib/src/vespa/searchlib/attribute/postinglistsearchcontext.hpp
+++ b/searchlib/src/vespa/searchlib/attribute/postinglistsearchcontext.hpp
@@ -3,7 +3,7 @@
#pragma once
#include "postinglistsearchcontext.h"
-#include "dociditerator.h"
+#include "array_iterator.h"
#include "attributeiterators.h"
#include "diversity.h"
#include "postingstore.hpp"
@@ -156,7 +156,7 @@ createPostingIterator(fef::TermFieldMatchData *matchData, bool strict)
if (_merger.hasArray() || _merger.hasBitVector()) { // synthetic results are available
if (!_merger.emptyArray()) {
assert(_merger.hasArray());
- using DocIt = DocIdIterator<Posting>;
+ using DocIt = ArrayIterator<Posting>;
DocIt postings;
vespalib::ConstArrayRef<Posting> array = _merger.getArray();
postings.set(&array[0], &array[array.size()]);
diff --git a/searchlib/src/vespa/searchlib/queryeval/document_weight_search_iterator.h b/searchlib/src/vespa/searchlib/queryeval/document_weight_search_iterator.h
index ec690b92e6c..448f1c8f2b4 100644
--- a/searchlib/src/vespa/searchlib/queryeval/document_weight_search_iterator.h
+++ b/searchlib/src/vespa/searchlib/queryeval/document_weight_search_iterator.h
@@ -3,7 +3,7 @@
#pragma once
#include "searchiterator.h"
-#include <vespa/searchlib/attribute/i_document_weight_attribute.h>
+#include <vespa/searchlib/attribute/i_docid_with_weight_posting_store.h>
#include <vespa/searchlib/fef/termfieldmatchdata.h>
namespace search::queryeval {
@@ -13,13 +13,13 @@ class DocumentWeightSearchIterator : public SearchIterator
private:
fef::TermFieldMatchData &_tfmd;
fef::TermFieldMatchDataPosition * _matchPosition;
- DocumentWeightIterator _iterator;
+ DocidWithWeightIterator _iterator;
queryeval::MinMaxPostingInfo _postingInfo;
public:
DocumentWeightSearchIterator(fef::TermFieldMatchData &tfmd,
- const IDocumentWeightAttribute &attr,
- IDocumentWeightAttribute::LookupResult dict_entry)
+ const IDocidWithWeightPostingStore &attr,
+ IDirectPostingStore::LookupResult dict_entry)
: _tfmd(tfmd),
_matchPosition(_tfmd.populate_fixed()),
_iterator(attr.create(dict_entry.posting_idx)),
diff --git a/searchlib/src/vespa/searchlib/queryeval/dot_product_search.cpp b/searchlib/src/vespa/searchlib/queryeval/dot_product_search.cpp
index fc5057b6a8d..8f4df612023 100644
--- a/searchlib/src/vespa/searchlib/queryeval/dot_product_search.cpp
+++ b/searchlib/src/vespa/searchlib/queryeval/dot_product_search.cpp
@@ -179,7 +179,7 @@ SearchIterator::UP
DotProductSearch::create(TermFieldMatchData &tmd,
bool field_is_filter,
const std::vector<int32_t> &weights,
- std::vector<DocumentWeightIterator> &&iterators)
+ std::vector<DocidWithWeightIterator> &&iterators)
{
using ArrayHeapImpl = DotProductSearchImpl<vespalib::LeftArrayHeap, AttributeIteratorPack>;
using HeapImpl = DotProductSearchImpl<vespalib::LeftHeap, AttributeIteratorPack>;
diff --git a/searchlib/src/vespa/searchlib/queryeval/dot_product_search.h b/searchlib/src/vespa/searchlib/queryeval/dot_product_search.h
index 34e288979e0..d06ea9439d2 100644
--- a/searchlib/src/vespa/searchlib/queryeval/dot_product_search.h
+++ b/searchlib/src/vespa/searchlib/queryeval/dot_product_search.h
@@ -36,7 +36,7 @@ public:
static SearchIterator::UP create(search::fef::TermFieldMatchData &tmd,
bool field_is_filter,
const std::vector<int32_t> &weights,
- std::vector<DocumentWeightIterator> &&iterators);
+ std::vector<DocidWithWeightIterator> &&iterators);
};
}
diff --git a/searchlib/src/vespa/searchlib/queryeval/matching_elements_search.cpp b/searchlib/src/vespa/searchlib/queryeval/matching_elements_search.cpp
index 88c6353269e..189d9c9a7a2 100644
--- a/searchlib/src/vespa/searchlib/queryeval/matching_elements_search.cpp
+++ b/searchlib/src/vespa/searchlib/queryeval/matching_elements_search.cpp
@@ -2,6 +2,7 @@
#include "matching_elements_search.h"
#include <vespa/searchcommon/attribute/attributecontent.h>
+#include <vespa/searchlib/attribute/i_docid_with_weight_posting_store.h>
#include <vespa/searchlib/attribute/integerbase.h>
#include <vespa/searchlib/attribute/stringbase.h>
#include <vespa/searchlib/common/matching_elements.h>
@@ -49,18 +50,18 @@ class FilterMatchingElementsSearch : public MatchingElementsSearch {
vespalib::hash_set<BufferType, vespalib::hash<BufferType>, EqualFunc> _matches;
public:
- FilterMatchingElementsSearch(const IAttributeVector &attr, EntryRef dictionary_snapshot, vespalib::ConstArrayRef<IDocumentWeightAttribute::LookupResult> dict_entries);
+ FilterMatchingElementsSearch(const IAttributeVector &attr, EntryRef dictionary_snapshot, vespalib::ConstArrayRef<IDirectPostingStore::LookupResult> dict_entries);
void find_matching_elements(uint32_t doc_id, MatchingElements& result) override;
void initRange(uint32_t begin_id, uint32_t end_id) override;
};
template <typename BufferType, typename AttributeType>
-FilterMatchingElementsSearch<BufferType, AttributeType>::FilterMatchingElementsSearch(const IAttributeVector &attr, EntryRef dictionary_snapshot, vespalib::ConstArrayRef<IDocumentWeightAttribute::LookupResult> dict_entries)
+FilterMatchingElementsSearch<BufferType, AttributeType>::FilterMatchingElementsSearch(const IAttributeVector &attr, EntryRef dictionary_snapshot, vespalib::ConstArrayRef<IDirectPostingStore::LookupResult> dict_entries)
: _attr(dynamic_cast<const AttributeType &>(attr)),
_content(),
_matches()
{
- auto dwa = attr.asDocumentWeightAttribute();
+ auto dwa = attr.as_docid_with_weight_posting_store();
assert(dwa != nullptr);
auto callback = [this](EntryRef folded) { _matches.insert(get_from_enum(_attr, folded)); };
for (auto &entry : dict_entries) {
@@ -95,7 +96,7 @@ FilterMatchingElementsSearch<BufferType, AttributeType>::initRange(uint32_t, uin
}
std::unique_ptr<MatchingElementsSearch>
-MatchingElementsSearch::create(const IAttributeVector &attr, EntryRef dictionary_snapshot, vespalib::ConstArrayRef<IDocumentWeightAttribute::LookupResult> dict_entries)
+MatchingElementsSearch::create(const IAttributeVector &attr, EntryRef dictionary_snapshot, vespalib::ConstArrayRef<IDirectPostingStore::LookupResult> dict_entries)
{
switch(attr.getBasicType()) {
case BasicType::INT64:
diff --git a/searchlib/src/vespa/searchlib/queryeval/matching_elements_search.h b/searchlib/src/vespa/searchlib/queryeval/matching_elements_search.h
index fafabeae591..dec9b8fd60b 100644
--- a/searchlib/src/vespa/searchlib/queryeval/matching_elements_search.h
+++ b/searchlib/src/vespa/searchlib/queryeval/matching_elements_search.h
@@ -5,7 +5,7 @@
#include <vector>
#include <cstdint>
#include <memory>
-#include <vespa/searchlib/attribute/i_document_weight_attribute.h>
+#include <vespa/searchlib/attribute/i_direct_posting_store.h>
namespace search { class MatchingElements; }
namespace search::attribute { class IAttributeVector; }
@@ -27,7 +27,7 @@ public:
virtual void find_matching_elements(uint32_t doc_id, MatchingElements& result) = 0;
virtual void initRange(uint32_t begin_id, uint32_t end_id) = 0;
- static std::unique_ptr<MatchingElementsSearch> create(const search::attribute::IAttributeVector &attr, vespalib::datastore::EntryRef dictionary_snapshot, vespalib::ConstArrayRef<IDocumentWeightAttribute::LookupResult> dict_entries);
+ static std::unique_ptr<MatchingElementsSearch> create(const search::attribute::IAttributeVector &attr, vespalib::datastore::EntryRef dictionary_snapshot, vespalib::ConstArrayRef<IDirectPostingStore::LookupResult> dict_entries);
};
}
diff --git a/searchlib/src/vespa/searchlib/queryeval/wand/parallel_weak_and_search.cpp b/searchlib/src/vespa/searchlib/queryeval/wand/parallel_weak_and_search.cpp
index e43eb3f4b6e..828ca4be08d 100644
--- a/searchlib/src/vespa/searchlib/queryeval/wand/parallel_weak_and_search.cpp
+++ b/searchlib/src/vespa/searchlib/queryeval/wand/parallel_weak_and_search.cpp
@@ -224,8 +224,8 @@ SearchIterator::UP
ParallelWeakAndSearch::create(search::fef::TermFieldMatchData &tfmd,
const MatchParams &matchParams,
const std::vector<int32_t> &weights,
- const std::vector<IDocumentWeightAttribute::LookupResult> &dict_entries,
- const IDocumentWeightAttribute &attr,
+ const std::vector<IDirectPostingStore::LookupResult> &dict_entries,
+ const IDocidWithWeightPostingStore &attr,
bool strict)
{
assert(weights.size() == dict_entries.size());
diff --git a/searchlib/src/vespa/searchlib/queryeval/wand/parallel_weak_and_search.h b/searchlib/src/vespa/searchlib/queryeval/wand/parallel_weak_and_search.h
index 5445d966887..bd173ab41eb 100644
--- a/searchlib/src/vespa/searchlib/queryeval/wand/parallel_weak_and_search.h
+++ b/searchlib/src/vespa/searchlib/queryeval/wand/parallel_weak_and_search.h
@@ -71,8 +71,8 @@ struct ParallelWeakAndSearch : public SearchIterator
static SearchIterator::UP create(fef::TermFieldMatchData &tmd,
const MatchParams &matchParams,
const std::vector<int32_t> &weights,
- const std::vector<IDocumentWeightAttribute::LookupResult> &dict_entries,
- const IDocumentWeightAttribute &attr,
+ const std::vector<IDirectPostingStore::LookupResult> &dict_entries,
+ const IDocidWithWeightPostingStore &attr,
bool strict);
};
diff --git a/searchlib/src/vespa/searchlib/queryeval/wand/wand_parts.h b/searchlib/src/vespa/searchlib/queryeval/wand/wand_parts.h
index a0d72cdfdf7..84fd2eb0d9e 100644
--- a/searchlib/src/vespa/searchlib/queryeval/wand/wand_parts.h
+++ b/searchlib/src/vespa/searchlib/queryeval/wand/wand_parts.h
@@ -11,7 +11,7 @@
#include <vespa/searchlib/attribute/iterator_pack.h>
#include <vespa/vespalib/objects/objectvisitor.h>
#include <vespa/vespalib/util/priority_queue.h>
-#include <vespa/searchlib/attribute/i_document_weight_attribute.h>
+#include <vespa/searchlib/attribute/i_docid_with_weight_posting_store.h>
#include <vespa/vespalib/util/stringfmt.h>
namespace search::queryeval::wand {
@@ -24,7 +24,7 @@ using score_t = int64_t;
using docid_t = uint32_t;
using ref_t = uint16_t;
-using Attr = IDocumentWeightAttribute;
+using Attr = IDirectPostingStore;
using AttrDictEntry = Attr::LookupResult;
using AttrDictEntries = std::vector<AttrDictEntry>;
@@ -94,9 +94,9 @@ struct TermInput {
struct AttrInput {
const std::vector<int32_t> &weights;
- const std::vector<IDocumentWeightAttribute::LookupResult> &dict_entries;
+ const std::vector<IDirectPostingStore::LookupResult> &dict_entries;
AttrInput(const std::vector<int32_t> &weights_in,
- const std::vector<IDocumentWeightAttribute::LookupResult> &dict_entries_in)
+ const std::vector<IDirectPostingStore::LookupResult> &dict_entries_in)
: weights(weights_in), dict_entries(dict_entries_in) {}
size_t size() const { return weights.size(); }
int32_t get_weight(ref_t ref) const { return weights[ref]; }
@@ -267,13 +267,13 @@ VectorizedIteratorTerms::VectorizedIteratorTerms(const Terms &t, const Scorer &,
struct VectorizedAttributeTerms : VectorizedState<AttributeIteratorPack> {
template <typename Scorer>
VectorizedAttributeTerms(const std::vector<int32_t> &weights,
- const std::vector<IDocumentWeightAttribute::LookupResult> &dict_entries,
- const IDocumentWeightAttribute &attr,
+ const std::vector<IDirectPostingStore::LookupResult> &dict_entries,
+ const IDocidWithWeightPostingStore &attr,
const Scorer &,
docid_t docIdLimit)
{
std::vector<ref_t> order = init_state<Scorer>(AttrInput(weights, dict_entries), docIdLimit);
- std::vector<DocumentWeightIterator> iterators;
+ std::vector<DocidWithWeightIterator> iterators;
iterators.reserve(order.size());
for (size_t i = 0; i < order.size(); ++i) {
attr.create(dict_entries[order[i]].posting_idx, iterators);
diff --git a/searchlib/src/vespa/searchlib/queryeval/weighted_set_term_search.cpp b/searchlib/src/vespa/searchlib/queryeval/weighted_set_term_search.cpp
index 32ae321e031..9e58cd489ac 100644
--- a/searchlib/src/vespa/searchlib/queryeval/weighted_set_term_search.cpp
+++ b/searchlib/src/vespa/searchlib/queryeval/weighted_set_term_search.cpp
@@ -188,7 +188,7 @@ SearchIterator::UP
WeightedSetTermSearch::create(fef::TermFieldMatchData &tmd,
bool field_is_filter,
const std::vector<int32_t> &weights,
- std::vector<DocumentWeightIterator> &&iterators)
+ std::vector<DocidWithWeightIterator> &&iterators)
{
using ArrayHeapImpl = WeightedSetTermSearchImpl<vespalib::LeftArrayHeap, AttributeIteratorPack>;
using HeapImpl = WeightedSetTermSearchImpl<vespalib::LeftHeap, AttributeIteratorPack>;
diff --git a/searchlib/src/vespa/searchlib/queryeval/weighted_set_term_search.h b/searchlib/src/vespa/searchlib/queryeval/weighted_set_term_search.h
index 6cda16a677c..17239391df8 100644
--- a/searchlib/src/vespa/searchlib/queryeval/weighted_set_term_search.h
+++ b/searchlib/src/vespa/searchlib/queryeval/weighted_set_term_search.h
@@ -36,7 +36,7 @@ public:
static SearchIterator::UP create(search::fef::TermFieldMatchData &tmd,
bool field_is_filter,
const std::vector<int32_t> &weights,
- std::vector<DocumentWeightIterator> &&iterators);
+ std::vector<DocidWithWeightIterator> &&iterators);
// used during docsum fetching to identify matching elements
// initRange must be called before use.
diff --git a/searchlib/src/vespa/searchlib/test/document_weight_attribute_helper.h b/searchlib/src/vespa/searchlib/test/document_weight_attribute_helper.h
index d25915358cb..059456c383b 100644
--- a/searchlib/src/vespa/searchlib/test/document_weight_attribute_helper.h
+++ b/searchlib/src/vespa/searchlib/test/document_weight_attribute_helper.h
@@ -1,7 +1,7 @@
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
-#include <vespa/searchlib/attribute/i_document_weight_attribute.h>
+#include <vespa/searchlib/attribute/i_docid_with_weight_posting_store.h>
#include <vespa/searchlib/attribute/attributevector.h>
#include <vespa/searchlib/attribute/multinumericattribute.h>
#include <vespa/searchlib/attribute/multinumericpostattribute.hpp>
@@ -15,7 +15,7 @@ class DocumentWeightAttributeHelper
private:
AttributeVector::SP _attr;
IntegerAttribute *_int_attr;
- const IDocumentWeightAttribute *_dwa;
+ const IDocidWithWeightPostingStore *_dww;
AttributeVector::SP make_attr();
@@ -23,10 +23,10 @@ public:
DocumentWeightAttributeHelper()
: _attr(make_attr()),
_int_attr(dynamic_cast<IntegerAttribute *>(_attr.get())),
- _dwa(_attr->asDocumentWeightAttribute())
+ _dww(_attr->as_docid_with_weight_posting_store())
{
ASSERT_TRUE(_int_attr != nullptr);
- ASSERT_TRUE(_dwa != nullptr);
+ ASSERT_TRUE(_dww != nullptr);
}
~DocumentWeightAttributeHelper();
@@ -45,7 +45,7 @@ public:
_int_attr->commit();
}
- const IDocumentWeightAttribute &dwa() const { return *_dwa; }
+ const IDocidWithWeightPostingStore &dww() const { return *_dww; }
};
}
diff --git a/searchlib/src/vespa/searchlib/test/weightedchildrenverifiers.h b/searchlib/src/vespa/searchlib/test/weightedchildrenverifiers.h
index d8a0b32c659..86d2fb9aa67 100644
--- a/searchlib/src/vespa/searchlib/test/weightedchildrenverifiers.h
+++ b/searchlib/src/vespa/searchlib/test/weightedchildrenverifiers.h
@@ -47,9 +47,9 @@ protected:
std::vector<DocIds> _split_lists;
};
-class DwaIteratorChildrenVerifier : public WeightedChildrenVerifier {
+class DwwIteratorChildrenVerifier : public WeightedChildrenVerifier {
public:
- DwaIteratorChildrenVerifier() :
+ DwwIteratorChildrenVerifier() :
WeightedChildrenVerifier(),
_helper()
{
@@ -59,18 +59,18 @@ public:
_helper.set_doc(full_list[i], i % _num_children, 1);
}
}
- ~DwaIteratorChildrenVerifier() override {}
+ ~DwwIteratorChildrenVerifier() override {}
SearchIterator::UP create(bool strict) const override {
(void) strict;
- std::vector<DocumentWeightIterator> children;
+ std::vector<DocidWithWeightIterator> children;
for (size_t i = 0; i < _num_children; ++i) {
- auto dict_entry = _helper.dwa().lookup(vespalib::make_string("%zu", i).c_str(), _helper.dwa().get_dictionary_snapshot());
- _helper.dwa().create(dict_entry.posting_idx, children);
+ auto dict_entry = _helper.dww().lookup(vespalib::make_string("%zu", i).c_str(), _helper.dww().get_dictionary_snapshot());
+ _helper.dww().create(dict_entry.posting_idx, children);
}
return create(std::move(children));
}
protected:
- virtual SearchIterator::UP create(std::vector<DocumentWeightIterator> &&) const {
+ virtual SearchIterator::UP create(std::vector<DocidWithWeightIterator> &&) const {
return {};
}
DocumentWeightAttributeHelper _helper;