Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions searchlib/src/tests/query/streaming/query_term_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,16 @@ std::vector<uint32_t> make_vec(std::vector<uint32_t> values) {

class QueryTermTest : public testing::Test {
protected:
QueryTermDataFactory _factory;
IndexEnvironment _index_env;
std::unique_ptr<Query> _query;
uint32_t _field_id;
QueryTerm* _node;
MatchDataLayout _mdl;
TermFieldHandle _normal_handle;
TermFieldHandle _filter_handle;
MatchData::UP _md;
TermFieldMatchData* _tfmd;
QueryTermDataFactory _factory;
IndexEnvironment _index_env;
std::unique_ptr<Query> _query;
uint32_t _field_id;
QueryTerm* _node;
MatchDataLayout _mdl;
TermFieldHandle _normal_handle;
TermFieldHandle _filter_handle;
MatchData::UP _md;
TermFieldMatchData* _tfmd;

QueryTermTest();
~QueryTermTest() override;
Expand Down
1 change: 1 addition & 0 deletions searchlib/src/vespa/searchlib/fef/matchdata.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#include "matchdata.h"

#include "matchdatalayout.h"

namespace search {
Expand Down
7 changes: 5 additions & 2 deletions searchlib/src/vespa/searchlib/fef/matchdata.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#include "handle.h"
#include "termfieldmatchdata.h"

#include <vespa/vespalib/util/typed_data_layout.h>

#include <memory>
Expand All @@ -20,7 +21,7 @@ using MatchDataBase = vespalib::tdl::Data<MatchDataDomain>;
**/
class MatchData : public MatchDataBase {
private:
double _termwise_limit;
double _termwise_limit;

public:
/**
Expand Down Expand Up @@ -79,7 +80,9 @@ class MatchData : public MatchDataBase {
* @return term field match data
* @param handle term field handle
**/
const TermFieldMatchData* resolveTermField(TermFieldHandle handle) const { return &all_of<TermFieldMatchData>()[handle]; }
const TermFieldMatchData* resolveTermField(TermFieldHandle handle) const {
return &all_of<TermFieldMatchData>()[handle];
}

static MatchData::UP makeTestInstance(uint32_t numTermFields, uint32_t fieldIdLimit);
};
Expand Down
6 changes: 3 additions & 3 deletions searchlib/src/vespa/searchlib/fef/matchdatalayout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ MatchDataLayout::~MatchDataLayout() = default;

MatchData::UP MatchDataLayout::createMatchData() const {
vespalib::tdl::Layout<MatchDataDomain, MatchData> layout;
auto ah = layout.reserve_array<TermFieldMatchData>(_fieldIds.size());
auto md = layout.create_data();
auto array = md->resolve_array<TermFieldMatchData>(ah);
auto ah = layout.reserve_array<TermFieldMatchData>(_fieldIds.size());
auto md = layout.create_data();
auto array = md->resolve_array<TermFieldMatchData>(ah);
assert(array.size() == _fieldIds.size());
for (size_t i = 0; i < _fieldIds.size(); ++i) {
array[i].setFieldId(_fieldIds[i]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -424,8 +424,8 @@ void MatchingElementsFillerTest::assert_same_element_single(const std::string& f
}

void MatchingElementsFillerTest::assert_near_elements(bool ordered, std::vector<uint32_t> expected_elements) {
MyQueryBuilder builder;
constexpr int child_count = 2;
MyQueryBuilder builder;
constexpr int child_count = 2;
constexpr size_t distance = 10;
constexpr size_t num_negative_children = 0;
constexpr size_t exclusion_distance = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,18 @@ class Matcher {
const HitList& hit_list, MatchingElements& matching_elements);
void find_matching_elements(SameElementQueryNode& same_element, uint32_t doc_lid,
MatchingElements& matching_elements);
void find_matching_elements(NearQueryNode& near_query_node, uint32_t doc_lid, MatchingElements& matching_elements);
void find_matching_elements(NearQueryNode& near_query_node, uint32_t doc_lid,
MatchingElements& matching_elements);
void find_matching_elements(const SubFieldTerm& sub_field_term, uint32_t doc_lid,
MatchingElements& matching_elements);

public:
Matcher(vsm::FieldIdTSearcherMap& field_searcher_map, const search::fef::IIndexEnvironment& index_env,
const MatchingElementsFields& fields, Query& query);
~Matcher();
bool empty() const { return _same_element_nodes.empty() && _near_query_nodes.empty() && _sub_field_terms.empty(); }
bool empty() const {
return _same_element_nodes.empty() && _near_query_nodes.empty() && _sub_field_terms.empty();
}
void find_matching_elements(const vsm::StorageDocument& doc, uint32_t doc_lid,
MatchingElements& matching_elements);
};
Expand Down Expand Up @@ -130,7 +133,7 @@ bool Matcher::has_matching_elements_field(QueryTerm& term) const {
auto& td = qtd.getTermData();
auto num_fields = td.numFields();
for (size_t i = 0; i < num_fields; ++i) {
auto field_id = td.field(i).getFieldId();
auto field_id = td.field(i).getFieldId();
if (has_matching_elements_field(field_id)) {
return true;
}
Expand All @@ -139,7 +142,7 @@ bool Matcher::has_matching_elements_field(QueryTerm& term) const {
}

bool Matcher::has_matching_elements_field(NearQueryNode& near) const {
auto check = [&](auto&& self, QueryNode &query_node){
auto check = [&](auto&& self, QueryNode& query_node) {
if (as<SameElementQueryNode>(query_node) != nullptr) {
return false;
} else if (auto query_term = as<QueryTerm>(query_node)) {
Expand Down Expand Up @@ -240,7 +243,8 @@ void Matcher::find_matching_elements(SameElementQueryNode& same_element, uint32_
}
}

void Matcher::find_matching_elements(NearQueryNode& near_query_node, uint32_t doc_lid, MatchingElements& matching_elements) {
void Matcher::find_matching_elements(NearQueryNode& near_query_node, uint32_t doc_lid,
MatchingElements& matching_elements) {
_match_spans.clear();
near_query_node.get_match_spans(_match_spans);
uint32_t field_id = IllegalFieldId;
Expand Down
9 changes: 5 additions & 4 deletions vespalib/src/vespa/vespalib/util/execution_profiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@ class ExecutionProfiler {
struct ProfilerTaskGuard {
ExecutionProfiler& profiler;
ProfilerTaskGuard(ExecutionProfiler& profiler_in, ExecutionProfiler::TaskId task) noexcept
: profiler(profiler_in) { profiler.start(task); }
: profiler(profiler_in) {
profiler.start(task);
}
ProfilerTaskGuard(const ProfilerTaskGuard&) = delete;
ProfilerTaskGuard& operator=(const ProfilerTaskGuard&) = delete;
~ProfilerTaskGuard() { profiler.complete(); }
Expand All @@ -86,10 +88,9 @@ struct ProfilerTaskGuard {
**/
class ProfilerNameGuard {
ExecutionProfiler* _profiler;

public:
ProfilerNameGuard(ExecutionProfiler* profiler_in, auto&& name_fn) noexcept
: _profiler(profiler_in)
{
ProfilerNameGuard(ExecutionProfiler* profiler_in, auto&& name_fn) noexcept : _profiler(profiler_in) {
if (_profiler != nullptr) {
_profiler->start(_profiler->resolve(name_fn()));
}
Expand Down