summaryrefslogtreecommitdiffstats
path: root/searchlib/src/tests/attribute
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2023-12-15 11:03:11 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2023-12-15 11:03:11 +0000
commit1e1ebc215480ab75e09f3cd7a016bbdf0831c423 (patch)
tree4781852ea529d7019c41c3c8bcc15f58ad38e6e9 /searchlib/src/tests/attribute
parent684abb75b1967c2fa019d3454627ff95c3435aa8 (diff)
- Add a doom that will not expire until it does not matter anymore.
- Doom can never be null. - Wire doom into fillBitVector. Using it will be a separate PR.
Diffstat (limited to 'searchlib/src/tests/attribute')
-rw-r--r--searchlib/src/tests/attribute/searchcontext/searchcontext_test.cpp6
-rw-r--r--searchlib/src/tests/attribute/tensorattribute/tensorattribute_test.cpp28
2 files changed, 15 insertions, 19 deletions
diff --git a/searchlib/src/tests/attribute/searchcontext/searchcontext_test.cpp b/searchlib/src/tests/attribute/searchcontext/searchcontext_test.cpp
index 6e334fffa75..d476f7d35d7 100644
--- a/searchlib/src/tests/attribute/searchcontext/searchcontext_test.cpp
+++ b/searchlib/src/tests/attribute/searchcontext/searchcontext_test.cpp
@@ -468,7 +468,7 @@ template <typename V, typename T>
ResultSetPtr
SearchContextTest::performSearch(const V & vec, const T & term)
{
- return performSearch(search::queryeval::ExecuteInfo::TRUE, vec, term, TermType::WORD);
+ return performSearch(queryeval::ExecuteInfo::TRUE, vec, term, TermType::WORD);
}
template <typename V, typename T>
@@ -503,7 +503,7 @@ void
SearchContextTest::performSearch(const V & vec, const vespalib::string & term,
const DocSet & expected, TermType termType)
{
- performSearch(search::queryeval::ExecuteInfo::TRUE, vec, term, expected, termType);
+ performSearch(queryeval::ExecuteInfo::TRUE, vec, term, expected, termType);
}
void
@@ -1113,7 +1113,7 @@ SearchContextTest::performRangeSearch(const VectorType & vec, const vespalib::st
{
for (size_t num_threads : {1,3}) {
vespalib::SimpleThreadBundle thread_bundle(num_threads);
- auto executeInfo = search::queryeval::ExecuteInfo::create(true, 1.0, nullptr, thread_bundle, true, true);
+ auto executeInfo = queryeval::ExecuteInfo::create(true, 1.0, vespalib::Doom::armageddon(), thread_bundle, true, true);
performSearch(executeInfo, vec, term, expected, TermType::WORD);
}
}
diff --git a/searchlib/src/tests/attribute/tensorattribute/tensorattribute_test.cpp b/searchlib/src/tests/attribute/tensorattribute/tensorattribute_test.cpp
index 81862b74eb2..0d3dccd2f1c 100644
--- a/searchlib/src/tests/attribute/tensorattribute/tensorattribute_test.cpp
+++ b/searchlib/src/tests/attribute/tensorattribute/tensorattribute_test.cpp
@@ -7,7 +7,6 @@
#include <vespa/searchlib/tensor/dense_tensor_attribute.h>
#include <vespa/searchlib/tensor/direct_tensor_attribute.h>
#include <vespa/searchlib/tensor/doc_vector_access.h>
-#include <vespa/searchlib/tensor/distance_functions.h>
#include <vespa/searchlib/tensor/hnsw_index.h>
#include <vespa/searchlib/tensor/mips_distance_transform.h>
#include <vespa/searchlib/tensor/nearest_neighbor_index.h>
@@ -25,7 +24,6 @@
#include <vespa/vespalib/testkit/test_kit.h>
#include <vespa/vespalib/util/mmap_file_allocator_factory.h>
#include <vespa/searchlib/util/bufferwriter.h>
-#include <vespa/vespalib/util/fake_doom.h>
#include <vespa/vespalib/util/threadstackexecutor.h>
#include <vespa/document/base/exceptions.h>
#include <vespa/eval/eval/fast_value.h>
@@ -132,7 +130,7 @@ private:
int _index_value;
public:
- MockIndexSaver(int index_value) : _index_value(index_value) {}
+ explicit MockIndexSaver(int index_value) noexcept : _index_value(index_value) {}
void save(search::BufferWriter& writer) const override {
writer.write(&_index_value, sizeof(int));
writer.flush();
@@ -158,7 +156,7 @@ public:
class MockPrepareResult : public PrepareResult {
public:
uint32_t docid;
- MockPrepareResult(uint32_t docid_in) : docid(docid_in) {}
+ explicit MockPrepareResult(uint32_t docid_in) noexcept : docid(docid_in) {}
};
class MockNearestNeighborIndex : public NearestNeighborIndex {
@@ -177,7 +175,7 @@ private:
int _index_value;
public:
- MockNearestNeighborIndex(const DocVectorAccess& vectors)
+ explicit MockNearestNeighborIndex(const DocVectorAccess& vectors)
: _vectors(vectors),
_adds(),
_removes(),
@@ -279,11 +277,11 @@ public:
}
vespalib::MemoryUsage update_stat(const CompactionStrategy&) override {
++_memory_usage_cnt;
- return vespalib::MemoryUsage();
+ return {};
}
vespalib::MemoryUsage memory_usage() const override {
++_memory_usage_cnt;
- return vespalib::MemoryUsage();
+ return {};
}
void populate_address_space_usage(AddressSpaceUsage&) const override {}
void get_state(const vespalib::slime::Inserter&) const override {}
@@ -293,7 +291,7 @@ public:
if (_index_value != 0) {
return std::make_unique<MockIndexSaver>(_index_value);
}
- return std::unique_ptr<NearestNeighborIndexSaver>();
+ return {};
}
std::unique_ptr<NearestNeighborIndexLoader> make_loader(FastOS_FileInterface& file, const vespalib::GenericHeader& header) override {
(void) header;
@@ -310,7 +308,7 @@ public:
(void) explore_k;
(void) doom;
(void) distance_threshold;
- return std::vector<Neighbor>();
+ return {};
}
std::vector<Neighbor> find_top_k_with_filter(uint32_t k,
const search::tensor::BoundDistanceFunction &df,
@@ -324,7 +322,7 @@ public:
(void) filter;
(void) doom;
(void) distance_threshold;
- return std::vector<Neighbor>();
+ return {};
}
search::tensor::DistanceFunctionFactory &distance_function_factory() const override {
@@ -427,7 +425,7 @@ struct Fixture {
FixtureTraits _traits;
vespalib::string _mmap_allocator_base_dir;
- Fixture(const vespalib::string &typeSpec, FixtureTraits traits = FixtureTraits());
+ explicit Fixture(const vespalib::string &typeSpec, FixtureTraits traits = FixtureTraits());
~Fixture();
@@ -589,7 +587,7 @@ struct Fixture {
}
TensorSpec expEmptyDenseTensor() const {
- return TensorSpec(denseSpec);
+ return {denseSpec};
}
vespalib::string expEmptyDenseTensorSpec() const {
@@ -1296,12 +1294,10 @@ template <typename ParentT>
class NearestNeighborBlueprintFixtureBase : public ParentT {
private:
std::unique_ptr<Value> _query_tensor;
- vespalib::FakeDoom _no_doom;
public:
NearestNeighborBlueprintFixtureBase()
- : _query_tensor(),
- _no_doom()
+ : _query_tensor()
{
this->set_tensor(1, vec_2d(1, 1));
this->set_tensor(2, vec_2d(2, 2));
@@ -1329,7 +1325,7 @@ public:
std::make_unique<DistanceCalculator>(this->as_dense_tensor(),
create_query_tensor(vec_2d(17, 42))),
3, approximate, 5, 100100.25,
- global_filter_lower_limit, 1.0, target_hits_max_adjustment_factor, _no_doom.get_doom());
+ global_filter_lower_limit, 1.0, target_hits_max_adjustment_factor, vespalib::Doom::armageddon());
EXPECT_EQUAL(11u, bp->getState().estimate().estHits);
EXPECT_EQUAL(100100.25 * 100100.25, bp->get_distance_threshold());
return bp;