aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2018-04-03 18:32:27 +0200
committerGitHub <noreply@github.com>2018-04-03 18:32:27 +0200
commit99c4a2573660d7bbb0fea00444a8177f2c8acd43 (patch)
tree3c062abb9a1416d210965fc652c10d3a8ba4bd06
parenta1d9168f0a76239ef284666561256c8fcf0c4b21 (diff)
parent6a793ea51e9446845b886d0f3825a54fbd47c692 (diff)
Merge pull request #5444 from vespa-engine/balder/DocumentWeightIteratorMustSupportTermWise
Balder/document weight iterator must support term wise
-rw-r--r--searchcommon/src/vespa/searchcommon/common/datatype.cpp6
-rw-r--r--searchcommon/src/vespa/searchcommon/common/datatype.h6
-rw-r--r--searchcommon/src/vespa/searchcommon/common/schema.h10
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/blueprintbuilder.h6
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/matchdatareservevisitor.h6
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/query.cpp6
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/querynodes.cpp6
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/querynodes.h7
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/resolveviewvisitor.h6
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/termdataextractor.h13
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/viewresolver.cpp6
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/viewresolver.h11
-rw-r--r--searchlib/src/tests/attribute/searchable/attribute_searchable_adapter_test.cpp73
-rw-r--r--searchlib/src/tests/attribute/searchable/attributeblueprint_test.cpp86
-rw-r--r--searchlib/src/vespa/searchlib/fef/iindexenvironment.h14
-rw-r--r--searchlib/src/vespa/searchlib/query/tree/node.h6
-rw-r--r--searchlib/src/vespa/searchlib/queryeval/create_blueprint_visitor_helper.cpp6
-rw-r--r--searchlib/src/vespa/searchlib/queryeval/create_blueprint_visitor_helper.h6
-rw-r--r--searchlib/src/vespa/searchlib/queryeval/dot_product_blueprint.cpp9
-rw-r--r--searchlib/src/vespa/searchlib/queryeval/dot_product_blueprint.h8
-rw-r--r--searchlib/src/vespa/searchlib/queryeval/dot_product_search.cpp6
-rw-r--r--searchlib/src/vespa/searchlib/queryeval/dot_product_search.h12
-rw-r--r--searchlib/src/vespa/searchlib/queryeval/get_weight_from_node.cpp6
-rw-r--r--searchlib/src/vespa/searchlib/queryeval/get_weight_from_node.h8
-rw-r--r--searchlib/src/vespa/searchlib/queryeval/intermediate_blueprints.cpp6
-rw-r--r--searchlib/src/vespa/searchlib/queryeval/intermediate_blueprints.h7
-rw-r--r--searchlib/src/vespa/searchlib/queryeval/irequestcontext.h11
-rw-r--r--searchlib/src/vespa/searchlib/queryeval/iterator_pack.cpp6
-rw-r--r--searchlib/src/vespa/searchlib/queryeval/iterator_pack.h9
-rw-r--r--searchlib/src/vespa/searchlib/queryeval/leaf_blueprints.cpp36
-rw-r--r--searchlib/src/vespa/searchlib/queryeval/leaf_blueprints.h12
-rw-r--r--searchlib/src/vespa/searchlib/queryeval/searchable.cpp6
-rw-r--r--searchlib/src/vespa/searchlib/queryeval/searchable.h9
-rw-r--r--searchlib/src/vespa/searchlib/queryeval/searchiterator.h11
-rw-r--r--searchlib/src/vespa/searchlib/queryeval/simple_phrase_blueprint.h8
-rw-r--r--searchlib/src/vespa/searchlib/queryeval/split_float.cpp7
-rw-r--r--searchlib/src/vespa/searchlib/queryeval/split_float.h7
-rw-r--r--searchlib/src/vespa/searchlib/queryeval/termasstring.cpp6
-rw-r--r--searchlib/src/vespa/searchlib/queryeval/termasstring.h9
-rw-r--r--searchlib/src/vespa/searchlib/queryeval/weighted_set_term_blueprint.h11
40 files changed, 167 insertions, 323 deletions
diff --git a/searchcommon/src/vespa/searchcommon/common/datatype.cpp b/searchcommon/src/vespa/searchcommon/common/datatype.cpp
index 12192bb1bec..81e6b8a1f34 100644
--- a/searchcommon/src/vespa/searchcommon/common/datatype.cpp
+++ b/searchcommon/src/vespa/searchcommon/common/datatype.cpp
@@ -5,9 +5,7 @@
#include <vespa/vespalib/stllike/asciistream.h>
#include <vespa/vespalib/util/arraysize.h>
-namespace search {
-namespace index {
-namespace schema {
+namespace search::index::schema {
using config::InvalidConfigException;
@@ -99,5 +97,3 @@ operator<<(std::ostream &os, const CollectionType &type)
}
}
-}
-}
diff --git a/searchcommon/src/vespa/searchcommon/common/datatype.h b/searchcommon/src/vespa/searchcommon/common/datatype.h
index 7ba21e0496c..ad762b9acc4 100644
--- a/searchcommon/src/vespa/searchcommon/common/datatype.h
+++ b/searchcommon/src/vespa/searchcommon/common/datatype.h
@@ -4,9 +4,7 @@
#include <vespa/vespalib/stllike/string.h>
-namespace search {
-namespace index {
-namespace schema {
+namespace search::index::schema {
/**
* Basic data type for a field.
@@ -46,5 +44,3 @@ std::ostream &operator<<(std::ostream &os, const CollectionType &type);
}
-}
-}
diff --git a/searchcommon/src/vespa/searchcommon/common/schema.h b/searchcommon/src/vespa/searchcommon/common/schema.h
index 7606b36a777..374ea840f5c 100644
--- a/searchcommon/src/vespa/searchcommon/common/schema.h
+++ b/searchcommon/src/vespa/searchcommon/common/schema.h
@@ -8,11 +8,8 @@
#include <vespa/vespalib/util/ptrholder.h>
#include <vector>
-namespace vespalib {
- class asciistream;
-}
-namespace search {
-namespace index {
+namespace vespalib { class asciistream; }
+namespace search::index {
/**
* Schema class used to give a high-level description of the content
@@ -419,5 +416,4 @@ public:
bool empty() const;
};
-} // namespace search::index
-} // namespace search
+}
diff --git a/searchcore/src/vespa/searchcore/proton/matching/blueprintbuilder.h b/searchcore/src/vespa/searchcore/proton/matching/blueprintbuilder.h
index 93439d97fc1..eb45a735780 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/blueprintbuilder.h
+++ b/searchcore/src/vespa/searchcore/proton/matching/blueprintbuilder.h
@@ -6,8 +6,7 @@
#include <vespa/searchlib/query/tree/node.h>
#include <vespa/searchlib/queryeval/blueprint.h>
-namespace proton {
-namespace matching {
+namespace proton::matching {
struct BlueprintBuilder {
/**
@@ -20,6 +19,5 @@ struct BlueprintBuilder {
ISearchContext &context);
};
-} // namespace matching
-} // namespace proton
+}
diff --git a/searchcore/src/vespa/searchcore/proton/matching/matchdatareservevisitor.h b/searchcore/src/vespa/searchcore/proton/matching/matchdatareservevisitor.h
index dcd95b9e473..ebe4e9b2ad7 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/matchdatareservevisitor.h
+++ b/searchcore/src/vespa/searchcore/proton/matching/matchdatareservevisitor.h
@@ -6,8 +6,7 @@
#include <vespa/searchlib/fef/matchdatalayout.h>
#include <vespa/searchlib/query/tree/templatetermvisitor.h>
-namespace proton {
-namespace matching {
+namespace proton::matching {
/**
* Visits all terms of a node tree, and allocates MatchData space for
@@ -34,6 +33,5 @@ public:
MatchDataReserveVisitor(search::fef::MatchDataLayout &mdl) : _mdl(mdl) {}
};
-} // namespace matching
-} // namespace proton
+}
diff --git a/searchcore/src/vespa/searchcore/proton/matching/query.cpp b/searchcore/src/vespa/searchcore/proton/matching/query.cpp
index e6408e89896..33118016d92 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/query.cpp
+++ b/searchcore/src/vespa/searchcore/proton/matching/query.cpp
@@ -33,8 +33,7 @@ using search::queryeval::SearchIterator;
using vespalib::string;
using std::vector;
-namespace proton {
-namespace matching {
+namespace proton::matching {
namespace {
void AddLocationNode(const string &location_str, Node::UP &query_tree, Location &fef_location) {
@@ -168,5 +167,4 @@ Query::createSearch(MatchData &md) const
return _blueprint->createSearch(md, true);
}
-} // namespace matching
-} // namespace proton
+}
diff --git a/searchcore/src/vespa/searchcore/proton/matching/querynodes.cpp b/searchcore/src/vespa/searchcore/proton/matching/querynodes.cpp
index 18fce357cb0..63302424db6 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/querynodes.cpp
+++ b/searchcore/src/vespa/searchcore/proton/matching/querynodes.cpp
@@ -25,8 +25,7 @@ using std::map;
using std::vector;
using vespalib::string;
-namespace proton {
-namespace matching {
+namespace proton::matching {
ProtonTermData::ProtonTermData() = default;
ProtonTermData::ProtonTermData(const ProtonTermData &) = default;
@@ -124,5 +123,4 @@ ProtonTermData::FieldEntry::getHandle() const
}
-} // namespace matching
-} // namespace proton
+}
diff --git a/searchcore/src/vespa/searchcore/proton/matching/querynodes.h b/searchcore/src/vespa/searchcore/proton/matching/querynodes.h
index 0729c9b37e9..ca6c8c75310 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/querynodes.h
+++ b/searchcore/src/vespa/searchcore/proton/matching/querynodes.h
@@ -16,8 +16,7 @@
#include <memory>
#include <vector>
-namespace proton {
-namespace matching {
+namespace proton::matching {
class ViewResolver;
@@ -157,6 +156,4 @@ struct ProtonNodeTypes {
typedef ProtonRegExpTerm RegExpTerm;
};
-} // namespace matching
-} // namespace proton
-
+}
diff --git a/searchcore/src/vespa/searchcore/proton/matching/resolveviewvisitor.h b/searchcore/src/vespa/searchcore/proton/matching/resolveviewvisitor.h
index 7f533ea1a8b..ee6fd470d89 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/resolveviewvisitor.h
+++ b/searchcore/src/vespa/searchcore/proton/matching/resolveviewvisitor.h
@@ -7,8 +7,7 @@
#include <vespa/searchlib/query/tree/templatetermvisitor.h>
#include <vespa/searchlib/fef/iindexenvironment.h>
-namespace proton {
-namespace matching {
+namespace proton::matching {
class ResolveViewVisitor
: public search::query::TemplateTermVisitor<ResolveViewVisitor,
@@ -31,6 +30,5 @@ public:
}
};
-} // namespace matching
-} // namespace proton
+}
diff --git a/searchcore/src/vespa/searchcore/proton/matching/termdataextractor.h b/searchcore/src/vespa/searchcore/proton/matching/termdataextractor.h
index 3d64acf9634..a6a3eb41e37 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/termdataextractor.h
+++ b/searchcore/src/vespa/searchcore/proton/matching/termdataextractor.h
@@ -4,13 +4,10 @@
#include <vector>
-namespace search {
-namespace query { class Node; }
-namespace fef { class ITermData; }
-} // namespace search
+namespace search::query { class Node; }
+namespace search::fef { class ITermData; }
-namespace proton {
-namespace matching {
+namespace proton::matching {
struct TermDataExtractor {
/**
@@ -21,6 +18,4 @@ struct TermDataExtractor {
std::vector<const search::fef::ITermData *> &td);
};
-} // namespace matching
-} // namespace proton
-
+}
diff --git a/searchcore/src/vespa/searchcore/proton/matching/viewresolver.cpp b/searchcore/src/vespa/searchcore/proton/matching/viewresolver.cpp
index 84210508960..b1442fe5e92 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/viewresolver.cpp
+++ b/searchcore/src/vespa/searchcore/proton/matching/viewresolver.cpp
@@ -3,8 +3,7 @@
#include "viewresolver.h"
#include <vespa/searchcommon/common/schema.h>
-namespace proton {
-namespace matching {
+namespace proton::matching {
ViewResolver &
ViewResolver::add(const vespalib::stringref &view,
@@ -43,5 +42,4 @@ ViewResolver::createFromSchema(const search::index::Schema &schema)
return resolver;
}
-} // namespace matching
-} // namespace proton
+}
diff --git a/searchcore/src/vespa/searchcore/proton/matching/viewresolver.h b/searchcore/src/vespa/searchcore/proton/matching/viewresolver.h
index d7a7f002e1c..124ebc67d52 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/viewresolver.h
+++ b/searchcore/src/vespa/searchcore/proton/matching/viewresolver.h
@@ -6,12 +6,9 @@
#include <vector>
#include <map>
-namespace search {
-namespace index { class Schema; }
-} // namespace search
+namespace search::index { class Schema; }
-namespace proton {
-namespace matching {
+namespace proton::matching {
/**
* A small utility class used to resolve views into fields when
@@ -66,6 +63,4 @@ public:
static ViewResolver createFromSchema(const search::index::Schema &schema);
};
-} // namespace matching
-} // namespace proton
-
+}
diff --git a/searchlib/src/tests/attribute/searchable/attribute_searchable_adapter_test.cpp b/searchlib/src/tests/attribute/searchable/attribute_searchable_adapter_test.cpp
index a6e06af1b71..1306a0aaaac 100644
--- a/searchlib/src/tests/attribute/searchable/attribute_searchable_adapter_test.cpp
+++ b/searchlib/src/tests/attribute/searchable/attribute_searchable_adapter_test.cpp
@@ -64,6 +64,7 @@ using search::queryeval::PostingInfo;
using search::queryeval::SearchIterator;
using std::vector;
using vespalib::string;
+using vespalib::make_string;
using namespace search::attribute;
using namespace search;
@@ -318,17 +319,13 @@ TEST("requireThatLocationTermsWork") {
// 0xcc is z-curve for (10, 10).
MyAttributeManager attribute_manager = makeAttributeManager(int64_t(0xcc));
- SimpleLocationTerm node(Location(Point(10, 10), 3, 0),
- field, 0, Weight(0));
+ SimpleLocationTerm node(Location(Point(10, 10), 3, 0), field, 0, Weight(0));
EXPECT_TRUE(search(node, attribute_manager));
- node = SimpleLocationTerm(Location(Point(100, 100), 3, 0),
- field, 0, Weight(0));
+ node = SimpleLocationTerm(Location(Point(100, 100), 3, 0), field, 0, Weight(0));
EXPECT_TRUE(!search(node, attribute_manager));
- node = SimpleLocationTerm(Location(Point(13, 13), 4, 0),
- field, 0, Weight(0));
+ node = SimpleLocationTerm(Location(Point(13, 13), 4, 0), field, 0, Weight(0));
EXPECT_TRUE(!search(node, attribute_manager));
- node = SimpleLocationTerm(Location(Point(10, 13), 3, 0),
- field, 0, Weight(0));
+ node = SimpleLocationTerm(Location(Point(10, 13), 3, 0), field, 0, Weight(0));
EXPECT_TRUE(search(node, attribute_manager));
}
@@ -336,17 +333,13 @@ TEST("requireThatOptimizedLocationTermsWork") {
// 0xcc is z-curve for (10, 10).
MyAttributeManager attribute_manager = makeFastSearchLongAttributeManager(int64_t(0xcc));
- SimpleLocationTerm node(Location(Point(10, 10), 3, 0),
- field, 0, Weight(0));
+ SimpleLocationTerm node(Location(Point(10, 10), 3, 0), field, 0, Weight(0));
EXPECT_TRUE(search(node, attribute_manager, true));
- node = SimpleLocationTerm(Location(Point(100, 100), 3, 0),
- field, 0, Weight(0));
+ node = SimpleLocationTerm(Location(Point(100, 100), 3, 0), field, 0, Weight(0));
EXPECT_TRUE(!search(node, attribute_manager, true));
- node = SimpleLocationTerm(Location(Point(13, 13), 4, 0),
- field, 0, Weight(0));
+ node = SimpleLocationTerm(Location(Point(13, 13), 4, 0), field, 0, Weight(0));
EXPECT_TRUE(!search(node, attribute_manager, true));
- node = SimpleLocationTerm(Location(Point(10, 13), 3, 0),
- field, 0, Weight(0));
+ node = SimpleLocationTerm(Location(Point(10, 13), 3, 0), field, 0, Weight(0));
EXPECT_TRUE(search(node, attribute_manager, true));
}
@@ -368,7 +361,7 @@ TEST("require that optimized location search works with wrapped bounding box (no
}
void set_weights(StringAttribute *attr, uint32_t docid,
- int32_t foo_weight, int32_t bar_weight, int32_t baz_weight)
+ int32_t foo_weight, int32_t bar_weight, int32_t baz_weight)
{
attr->clearDoc(docid);
if (foo_weight > 0) attr->append(docid, "foo", foo_weight);
@@ -377,9 +370,10 @@ void set_weights(StringAttribute *attr, uint32_t docid,
attr->commit();
}
-MyAttributeManager make_weighted_string_attribute_manager(bool fast_search) {
+MyAttributeManager make_weighted_string_attribute_manager(bool fast_search, bool isFilter = false) {
Config cfg(BasicType::STRING, CollectionType::WSET);
cfg.setFastSearch(fast_search);
+ cfg.setIsFilter(isFilter);
AttributeVector::SP attr_ptr = AttributeFactory::createAttribute(field, cfg);
StringAttribute *attr = static_cast<StringAttribute *>(attr_ptr.get());
add_docs(attr, num_docs);
@@ -456,13 +450,11 @@ TEST("require that direct attribute iterators work") {
EXPECT_TRUE(result.has_minmax);
EXPECT_EQUAL(100, result.min_weight);
EXPECT_EQUAL(1000, result.max_weight);
- EXPECT_TRUE(result.iterator_dump.find("DocumentWeightSearchIterator")
- != vespalib::string::npos);
+ EXPECT_TRUE(result.iterator_dump.find("DocumentWeightSearchIterator") != vespalib::string::npos);
} else {
EXPECT_EQUAL(num_docs, result.est_hits);
EXPECT_FALSE(result.has_minmax);
- EXPECT_TRUE(result.iterator_dump.find("DocumentWeightSearchIterator")
- == vespalib::string::npos);
+ EXPECT_TRUE(result.iterator_dump.find("DocumentWeightSearchIterator") == vespalib::string::npos);
}
ASSERT_EQUAL(3u, result.hits.size());
EXPECT_FALSE(result.est_empty);
@@ -472,6 +464,26 @@ TEST("require that direct attribute iterators work") {
}
}
+TEST("require that single weighted set turns filter on filter fields") {
+ bool fast_search = true;
+ bool strict = true;
+ bool isFilter = true;
+ MyAttributeManager attribute_manager = make_weighted_string_attribute_manager(fast_search, isFilter);
+ SimpleStringTerm empty_node("notfoo", "", 0, Weight(1));
+ Result empty_result = do_search(attribute_manager, empty_node, strict);
+ EXPECT_EQUAL(0u, empty_result.hits.size());
+ SimpleStringTerm node("foo", "", 0, Weight(1));
+ Result result = do_search(attribute_manager, node, strict);
+ EXPECT_EQUAL(3u, result.est_hits);
+ EXPECT_TRUE(result.iterator_dump.find("DocumentWeightSearchIterator") == vespalib::string::npos);
+ EXPECT_TRUE(result.iterator_dump.find("FilterAttributePostingListIteratorT") != vespalib::string::npos);
+ ASSERT_EQUAL(3u, result.hits.size());
+ EXPECT_FALSE(result.est_empty);
+ EXPECT_EQUAL(20u, result.hits[0].docid);
+ EXPECT_EQUAL(40u, result.hits[1].docid);
+ EXPECT_EQUAL(50u, result.hits[2].docid);
+}
+
const char *as_str(bool flag) { return flag? "true" : "false"; }
TEST("require that attribute parallel wand works") {
@@ -551,10 +563,7 @@ TEST("require that predicate query in non-predicate field yields empty.") {
}
TEST("require that predicate query in predicate field yields results.") {
- PredicateAttribute *attr =
- new PredicateAttribute(
- field, Config(BasicType::PREDICATE,
- CollectionType::SINGLE));
+ PredicateAttribute *attr = new PredicateAttribute(field, Config(BasicType::PREDICATE, CollectionType::SINGLE));
add_docs(attr, num_docs);
attr->getIndex().indexEmptyDocument(2); // matches anything
attr->getIndex().commit();
@@ -611,10 +620,8 @@ void set_attr_value(AttributeVector &attr, uint32_t docid, size_t value) {
}
}
-MyAttributeManager make_diversity_setup(BasicType::Type field_type,
- bool field_fast_search,
- BasicType::Type other_type,
- bool other_fast_search)
+MyAttributeManager make_diversity_setup(BasicType::Type field_type, bool field_fast_search,
+ BasicType::Type other_type, bool other_fast_search)
{
Config field_cfg(field_type, CollectionType::SINGLE);
field_cfg.setFastSearch(field_fast_search);
@@ -663,9 +670,9 @@ TEST("require that diversity range searches work for various types") {
for (bool other_fast_search: std::vector<bool>({true, false})) {
MyAttributeManager manager = make_diversity_setup(field_type, true, other_type, other_fast_search);
for (bool strict: std::vector<bool>({true, false})) {
- TEST_STATE(vespalib::make_string("field_type: %s, other_type: %s, other_fast_search: %s, strict: %s",
- BasicType(field_type).asString(), BasicType(other_type).asString(),
- other_fast_search ? "true" : "false", strict ? "true" : "false").c_str());
+ TEST_STATE(make_string("field_type: %s, other_type: %s, other_fast_search: %s, strict: %s",
+ BasicType(field_type).asString(), BasicType(other_type).asString(),
+ other_fast_search ? "true" : "false", strict ? "true" : "false").c_str());
EXPECT_EQUAL(999u, diversity_hits(manager, "[;;1000;other;10]", strict));
EXPECT_EQUAL(999u, diversity_hits(manager, "[;;-1000;other;10]", strict));
EXPECT_EQUAL(100u, diversity_hits(manager, "[;;1000;other;1]", strict));
diff --git a/searchlib/src/tests/attribute/searchable/attributeblueprint_test.cpp b/searchlib/src/tests/attribute/searchable/attributeblueprint_test.cpp
index db6df2d1140..6753153c224 100644
--- a/searchlib/src/tests/attribute/searchable/attributeblueprint_test.cpp
+++ b/searchlib/src/tests/attribute/searchable/attributeblueprint_test.cpp
@@ -43,34 +43,6 @@ using namespace search;
namespace {
-class Test : public vespalib::TestApp {
- void requireThatIteratorsCanBeCreated();
- void requireThatRangeTermsWorkToo();
- void requireThatPrefixTermsWork();
- void requireThatLocationTermsWork();
- void requireThatFastSearchLocationTermsWork();
-
- bool search(const string &term, IAttributeManager &attribute_manager);
- bool search(const Node &term, IAttributeManager &attribute_manager);
-
-public:
- int Main() override;
-};
-
-int
-Test::Main()
-{
- TEST_INIT("attributeblueprint_test");
-
- TEST_DO(requireThatIteratorsCanBeCreated());
- TEST_DO(requireThatRangeTermsWorkToo());
- TEST_DO(requireThatPrefixTermsWork());
- TEST_DO(requireThatLocationTermsWork());
- TEST_DO(requireThatFastSearchLocationTermsWork());
-
- TEST_DONE();
-}
-
const string field = "field";
const int32_t weight = 1;
@@ -105,16 +77,9 @@ public:
}
};
-bool Test::search(const string &term, IAttributeManager &attribute_manager) {
- TEST_STATE(term.c_str());
- SimpleStringTerm node(term, "field", 0, Weight(0));
- bool ret = search(node, attribute_manager);
- return ret;
-}
-
constexpr uint32_t DOCID_LIMIT = 3;
-bool Test::search(const Node &node, IAttributeManager &attribute_manager) {
+bool search(const Node &node, IAttributeManager &attribute_manager) {
AttributeContext ac(attribute_manager);
FakeRequestContext requestContext(&ac);
MatchData::UP md(MatchData::makeTestInstance(1, 1));
@@ -132,6 +97,13 @@ bool Test::search(const Node &node, IAttributeManager &attribute_manager) {
return iterator->seek(2);
}
+bool search(const string &term, IAttributeManager &attribute_manager) {
+ TEST_STATE(term.c_str());
+ SimpleStringTerm node(term, "field", 0, Weight(0));
+ bool ret = search(node, attribute_manager);
+ return ret;
+}
+
template <typename T> struct AttributeVectorTypeFinder {
typedef SingleStringExtAttribute Type;
static void add(Type & a, const T & v) { a.add(v, weight); }
@@ -173,13 +145,15 @@ MyAttributeManager makeFastSearchLongAttribute(int64_t value) {
return fill<FastSearchLongAttribute, int64_t>(attr, value);
}
-void Test::requireThatIteratorsCanBeCreated() {
+} // namespace
+
+TEST("requireThatIteratorsCanBeCreated") {
MyAttributeManager attribute_manager = makeAttributeManager("foo");
EXPECT_TRUE(search("foo", attribute_manager));
}
-void Test::requireThatRangeTermsWorkToo() {
+TEST("requireThatRangeTermsWorkToo") {
MyAttributeManager attribute_manager = makeAttributeManager(int64_t(42));
EXPECT_TRUE(search("[23;46]", attribute_manager));
@@ -188,7 +162,7 @@ void Test::requireThatRangeTermsWorkToo() {
EXPECT_TRUE(search("[10;]", attribute_manager));
}
-void Test::requireThatPrefixTermsWork()
+TEST("requireThatPrefixTermsWork")
{
MyAttributeManager attribute_manager = makeAttributeManager("foo");
@@ -196,44 +170,34 @@ void Test::requireThatPrefixTermsWork()
EXPECT_TRUE(search(node, attribute_manager));
}
-void Test::requireThatLocationTermsWork() {
+TEST("requireThatLocationTermsWork") {
// 0xcc is z-curve for (10, 10).
MyAttributeManager attribute_manager = makeAttributeManager(int64_t(0xcc));
- SimpleLocationTerm node(Location(Point(10, 10), 3, 0),
- field, 0, Weight(0));
+ SimpleLocationTerm node(Location(Point(10, 10), 3, 0), field, 0, Weight(0));
EXPECT_TRUE(search(node, attribute_manager));
- node = SimpleLocationTerm(Location(Point(100, 100), 3, 0),
- field, 0, Weight(0));
+ node = SimpleLocationTerm(Location(Point(100, 100), 3, 0), field, 0, Weight(0));
EXPECT_TRUE(!search(node, attribute_manager));
- node = SimpleLocationTerm(Location(Point(13, 13), 4, 0),
- field, 0, Weight(0));
+ node = SimpleLocationTerm(Location(Point(13, 13), 4, 0), field, 0, Weight(0));
EXPECT_TRUE(!search(node, attribute_manager));
- node = SimpleLocationTerm(Location(Point(10, 13), 3, 0),
- field, 0, Weight(0));
+ node = SimpleLocationTerm(Location(Point(10, 13), 3, 0), field, 0, Weight(0));
EXPECT_TRUE(search(node, attribute_manager));
}
-void Test::requireThatFastSearchLocationTermsWork() {
+TEST("requireThatFastSearchLocationTermsWork") {
// 0xcc is z-curve for (10, 10).
MyAttributeManager attribute_manager = makeFastSearchLongAttribute(int64_t(0xcc));
- SimpleLocationTerm node(Location(Point(10, 10), 3, 0),
- field, 0, Weight(0));
+ SimpleLocationTerm node(Location(Point(10, 10), 3, 0), field, 0, Weight(0));
#if 0
EXPECT_TRUE(search(node, attribute_manager));
- node = SimpleLocationTerm(Location(Point(100, 100), 3, 0),
- field, 0, Weight(0));
+ node = SimpleLocationTerm(Location(Point(100, 100), 3, 0),field, 0, Weight(0));
EXPECT_TRUE(!search(node, attribute_manager));
- node = SimpleLocationTerm(Location(Point(13, 13), 4, 0),
- field, 0, Weight(0));
+ node = SimpleLocationTerm(Location(Point(13, 13), 4, 0),field, 0, Weight(0));
EXPECT_TRUE(!search(node, attribute_manager));
- node = SimpleLocationTerm(Location(Point(10, 13), 3, 0),
- field, 0, Weight(0));
+ node = SimpleLocationTerm(Location(Point(10, 13), 3, 0),field, 0, Weight(0));
EXPECT_TRUE(search(node, attribute_manager));
#endif
}
-
-} // namespace
-
-TEST_APPHOOK(Test);
+
+TEST_MAIN() { TEST_RUN_ALL(); }
diff --git a/searchlib/src/vespa/searchlib/fef/iindexenvironment.h b/searchlib/src/vespa/searchlib/fef/iindexenvironment.h
index 470f5d3491b..b35d8972300 100644
--- a/searchlib/src/vespa/searchlib/fef/iindexenvironment.h
+++ b/searchlib/src/vespa/searchlib/fef/iindexenvironment.h
@@ -4,16 +4,9 @@
#include <vespa/vespalib/stllike/string.h>
-namespace vespalib {
-namespace eval {
+namespace vespalib::eval { class ConstantValue; }
-class ConstantValue;
-
-}
-}
-
-namespace search {
-namespace fef {
+namespace search::fef {
class Properties;
class FieldInfo;
@@ -133,6 +126,5 @@ public:
virtual ~IIndexEnvironment() {}
};
-} // namespace fef
-} // namespace search
+}
diff --git a/searchlib/src/vespa/searchlib/query/tree/node.h b/searchlib/src/vespa/searchlib/query/tree/node.h
index 7f7614cac81..fe6f1b4b3b0 100644
--- a/searchlib/src/vespa/searchlib/query/tree/node.h
+++ b/searchlib/src/vespa/searchlib/query/tree/node.h
@@ -3,8 +3,7 @@
#include <memory>
-namespace search {
-namespace query {
+namespace search::query {
class QueryVisitor;
@@ -21,6 +20,5 @@ class Node {
virtual void accept(QueryVisitor &visitor) = 0;
};
-} // namespace query
-} // namespace search
+}
diff --git a/searchlib/src/vespa/searchlib/queryeval/create_blueprint_visitor_helper.cpp b/searchlib/src/vespa/searchlib/queryeval/create_blueprint_visitor_helper.cpp
index 05784149b59..8e6429aaa90 100644
--- a/searchlib/src/vespa/searchlib/queryeval/create_blueprint_visitor_helper.cpp
+++ b/searchlib/src/vespa/searchlib/queryeval/create_blueprint_visitor_helper.cpp
@@ -10,8 +10,7 @@
#include "weighted_set_term_blueprint.h"
#include "split_float.h"
-namespace search {
-namespace queryeval {
+namespace search::queryeval {
CreateBlueprintVisitorHelper::CreateBlueprintVisitorHelper(Searchable &searchable, const FieldSpec &field, const IRequestContext & requestContext)
: _requestContext(requestContext),
@@ -99,5 +98,4 @@ CreateBlueprintVisitorHelper::visitWandTerm(search::query::WandTerm &n) {
createWeightedSet(bp, n);
}
-} // namespace search::queryeval
-} // namespace search
+}
diff --git a/searchlib/src/vespa/searchlib/queryeval/create_blueprint_visitor_helper.h b/searchlib/src/vespa/searchlib/queryeval/create_blueprint_visitor_helper.h
index 0734d7fe0d6..cded9c103dc 100644
--- a/searchlib/src/vespa/searchlib/queryeval/create_blueprint_visitor_helper.h
+++ b/searchlib/src/vespa/searchlib/queryeval/create_blueprint_visitor_helper.h
@@ -10,8 +10,7 @@
#include <vespa/searchlib/query/tree/simplequery.h>
#include <memory>
-namespace search {
-namespace queryeval {
+namespace search::queryeval {
class CreateBlueprintVisitorHelper : public search::query::QueryVisitor
{
@@ -76,5 +75,4 @@ public:
void visit(search::query::RegExpTerm &n) override = 0;
};
-} // namespace search::queryeval
-} // namespace search
+}
diff --git a/searchlib/src/vespa/searchlib/queryeval/dot_product_blueprint.cpp b/searchlib/src/vespa/searchlib/queryeval/dot_product_blueprint.cpp
index 416ff9dce9d..f76cd0d6acc 100644
--- a/searchlib/src/vespa/searchlib/queryeval/dot_product_blueprint.cpp
+++ b/searchlib/src/vespa/searchlib/queryeval/dot_product_blueprint.cpp
@@ -2,13 +2,9 @@
#include "dot_product_blueprint.h"
#include "dot_product_search.h"
-#include <vespa/searchlib/fef/termfieldmatchdata.h>
-#include <vespa/searchlib/queryeval/searchiterator.h>
#include <vespa/vespalib/objects/visit.hpp>
-#include <algorithm>
-namespace search {
-namespace queryeval {
+namespace search::queryeval {
DotProductBlueprint::DotProductBlueprint(const FieldSpec &field)
: ComplexLeafBlueprint(field),
@@ -84,5 +80,4 @@ DotProductBlueprint::visitMembers(vespalib::ObjectVisitor &visitor) const
visit(visitor, "_terms", _terms);
}
-} // namespace search::queryeval
-} // namespace search
+}
diff --git a/searchlib/src/vespa/searchlib/queryeval/dot_product_blueprint.h b/searchlib/src/vespa/searchlib/queryeval/dot_product_blueprint.h
index 80599f771d0..e19a6cdb7f9 100644
--- a/searchlib/src/vespa/searchlib/queryeval/dot_product_blueprint.h
+++ b/searchlib/src/vespa/searchlib/queryeval/dot_product_blueprint.h
@@ -5,10 +5,9 @@
#include "searchable.h"
#include <vespa/searchlib/fef/matchdatalayout.h>
-namespace search {
-namespace fef { class TermFieldMatchData; }
+namespace search::fef { class TermFieldMatchData; }
-namespace queryeval {
+namespace search::queryeval {
class DotProductBlueprint : public ComplexLeafBlueprint
{
@@ -38,5 +37,4 @@ public:
void fetchPostings(bool strict) override;
};
-} // namespace search::queryeval
-} // namespace search
+}
diff --git a/searchlib/src/vespa/searchlib/queryeval/dot_product_search.cpp b/searchlib/src/vespa/searchlib/queryeval/dot_product_search.cpp
index 34e00f8d3a8..5dba818c7a6 100644
--- a/searchlib/src/vespa/searchlib/queryeval/dot_product_search.cpp
+++ b/searchlib/src/vespa/searchlib/queryeval/dot_product_search.cpp
@@ -9,8 +9,7 @@ using search::fef::TermFieldMatchData;
using search::fef::MatchData;
using vespalib::ObjectVisitor;
-namespace search {
-namespace queryeval {
+namespace search::queryeval {
template <typename HEAP, typename IteratorPack>
@@ -182,5 +181,4 @@ DotProductSearch::create(TermFieldMatchData &tmd,
//-----------------------------------------------------------------------------
-} // namespace search::queryeval
-} // namespace search
+}
diff --git a/searchlib/src/vespa/searchlib/queryeval/dot_product_search.h b/searchlib/src/vespa/searchlib/queryeval/dot_product_search.h
index 65c12e00af3..0fa047bb215 100644
--- a/searchlib/src/vespa/searchlib/queryeval/dot_product_search.h
+++ b/searchlib/src/vespa/searchlib/queryeval/dot_product_search.h
@@ -7,15 +7,10 @@
#include <vespa/searchlib/fef/matchdata.h>
#include <vespa/searchlib/fef/termfieldmatchdataarray.h>
#include <vespa/searchlib/attribute/iterator_pack.h>
-#include <memory>
-#include <vector>
-namespace search {
-namespace fef {
-class TermFieldMatchData;
-} // namespace fef
+namespace search::fef { class TermFieldMatchData; }
-namespace queryeval {
+namespace search::queryeval {
/**
* Search iterator for a sparse dot product, based on a set of child
@@ -41,6 +36,5 @@ public:
std::vector<DocumentWeightIterator> &&iterators);
};
-} // namespace search::queryeval
-} // namespace search
+}
diff --git a/searchlib/src/vespa/searchlib/queryeval/get_weight_from_node.cpp b/searchlib/src/vespa/searchlib/queryeval/get_weight_from_node.cpp
index cfa0f2fefcf..8fa6af74ae2 100644
--- a/searchlib/src/vespa/searchlib/queryeval/get_weight_from_node.cpp
+++ b/searchlib/src/vespa/searchlib/queryeval/get_weight_from_node.cpp
@@ -10,8 +10,7 @@ using search::query::SimpleQueryNodeTypes;
using search::query::TemplateTermVisitor;
using search::query::Weight;
-namespace search {
-namespace queryeval {
+namespace search::queryeval {
namespace {
struct WeightExtractor : public TemplateTermVisitor<WeightExtractor,
@@ -38,5 +37,4 @@ getWeightFromNode(const Node &node)
return extractor.weight;
}
-} // namespace search::queryeval
-} // namespace search
+}
diff --git a/searchlib/src/vespa/searchlib/queryeval/get_weight_from_node.h b/searchlib/src/vespa/searchlib/queryeval/get_weight_from_node.h
index 5ef4a4893b8..25ae400fb83 100644
--- a/searchlib/src/vespa/searchlib/queryeval/get_weight_from_node.h
+++ b/searchlib/src/vespa/searchlib/queryeval/get_weight_from_node.h
@@ -4,12 +4,10 @@
#include <vespa/searchlib/query/weight.h>
-namespace search {
-namespace query { class Node; }
-namespace queryeval {
+namespace search::query { class Node; }
+namespace search::queryeval {
search::query::Weight getWeightFromNode(const search::query::Node &node);
-} // namespace search::queryeval
-} // namespace search
+}
diff --git a/searchlib/src/vespa/searchlib/queryeval/intermediate_blueprints.cpp b/searchlib/src/vespa/searchlib/queryeval/intermediate_blueprints.cpp
index 65eb7127692..9bc9d3161e6 100644
--- a/searchlib/src/vespa/searchlib/queryeval/intermediate_blueprints.cpp
+++ b/searchlib/src/vespa/searchlib/queryeval/intermediate_blueprints.cpp
@@ -12,8 +12,7 @@
#include "isourceselector.h"
#include <vespa/searchlib/queryeval/wand/weak_and_search.h>
-namespace search {
-namespace queryeval {
+namespace search::queryeval {
//-----------------------------------------------------------------------------
@@ -581,5 +580,4 @@ SourceBlenderBlueprint::isCompatibleWith(const SourceBlenderBlueprint &other) co
//-----------------------------------------------------------------------------
-} // namespace queryeval
-} // namespace search
+}
diff --git a/searchlib/src/vespa/searchlib/queryeval/intermediate_blueprints.h b/searchlib/src/vespa/searchlib/queryeval/intermediate_blueprints.h
index 7c847545814..440794c25d8 100644
--- a/searchlib/src/vespa/searchlib/queryeval/intermediate_blueprints.h
+++ b/searchlib/src/vespa/searchlib/queryeval/intermediate_blueprints.h
@@ -3,11 +3,9 @@
#pragma once
#include "blueprint.h"
-#include "searchable.h"
-#include <vespa/searchlib/queryeval/multisearch.h>
+#include "multisearch.h"
-namespace search {
-namespace queryeval {
+namespace search::queryeval {
class ISourceSelector;
@@ -175,4 +173,3 @@ public:
};
}
-}
diff --git a/searchlib/src/vespa/searchlib/queryeval/irequestcontext.h b/searchlib/src/vespa/searchlib/queryeval/irequestcontext.h
index 2809f0767fb..b779ac400bf 100644
--- a/searchlib/src/vespa/searchlib/queryeval/irequestcontext.h
+++ b/searchlib/src/vespa/searchlib/queryeval/irequestcontext.h
@@ -5,13 +5,9 @@
#include <vespa/vespalib/util/doom.h>
#include <vespa/vespalib/stllike/string.h>
-namespace search {
+namespace search::attribute { class IAttributeVector; }
-namespace attribute {
-class IAttributeVector;
-}
-
-namespace queryeval {
+namespace search::queryeval {
/**
* Provides a context that follows the life of a query.
@@ -35,5 +31,4 @@ public:
virtual const attribute::IAttributeVector *getAttributeStableEnum(const vespalib::string &name) const = 0;
};
-} // namespace queryeval
-} // namespace search
+}
diff --git a/searchlib/src/vespa/searchlib/queryeval/iterator_pack.cpp b/searchlib/src/vespa/searchlib/queryeval/iterator_pack.cpp
index 1f5858c1100..b11f85e09f9 100644
--- a/searchlib/src/vespa/searchlib/queryeval/iterator_pack.cpp
+++ b/searchlib/src/vespa/searchlib/queryeval/iterator_pack.cpp
@@ -2,11 +2,9 @@
#include "iterator_pack.h"
#include "termwise_helper.h"
-#include <vespa/searchlib/common/bitvector.h>
#include <vespa/searchlib/fef/matchdata.h>
-namespace search {
-namespace queryeval {
+namespace search::queryeval {
SearchIteratorPack::~SearchIteratorPack() { }
@@ -61,5 +59,3 @@ SearchIteratorPack::or_hits_into(BitVector &result, uint32_t begin_id) const {
}
-} // namespace search
-
diff --git a/searchlib/src/vespa/searchlib/queryeval/iterator_pack.h b/searchlib/src/vespa/searchlib/queryeval/iterator_pack.h
index 58c774e0903..d35c1749f40 100644
--- a/searchlib/src/vespa/searchlib/queryeval/iterator_pack.h
+++ b/searchlib/src/vespa/searchlib/queryeval/iterator_pack.h
@@ -5,11 +5,9 @@
#include "searchiterator.h"
#include <vespa/searchlib/fef/termfieldmatchdata.h>
-namespace search {
+namespace search::fef { class MatchData; }
-namespace fef { class MatchData; }
-
-namespace queryeval {
+namespace search::queryeval {
class SearchIteratorPack
{
@@ -61,6 +59,5 @@ public:
void or_hits_into(BitVector &result, uint32_t begin_id) const;
};
-} // namespace queryevel
-} // namespace search
+}
diff --git a/searchlib/src/vespa/searchlib/queryeval/leaf_blueprints.cpp b/searchlib/src/vespa/searchlib/queryeval/leaf_blueprints.cpp
index e4b3e89847c..bbfa487ae7d 100644
--- a/searchlib/src/vespa/searchlib/queryeval/leaf_blueprints.cpp
+++ b/searchlib/src/vespa/searchlib/queryeval/leaf_blueprints.cpp
@@ -5,8 +5,7 @@
#include "simplesearch.h"
#include "fake_search.h"
-namespace search {
-namespace queryeval {
+namespace search::queryeval {
//-----------------------------------------------------------------------------
@@ -14,7 +13,7 @@ SearchIterator::UP
EmptyBlueprint::createLeafSearch(const search::fef::TermFieldMatchDataArray &,
bool) const
{
- return SearchIterator::UP(new EmptySearch());
+ return std::make_unique<EmptySearch>();
}
EmptyBlueprint::EmptyBlueprint(const FieldSpecBase &field)
@@ -35,8 +34,7 @@ EmptyBlueprint::EmptyBlueprint()
//-----------------------------------------------------------------------------
SearchIterator::UP
-SimpleBlueprint::createLeafSearch(const search::fef::TermFieldMatchDataArray &,
- bool) const
+SimpleBlueprint::createLeafSearch(const search::fef::TermFieldMatchDataArray &, bool) const
{
SimpleSearch *ss = new SimpleSearch(_result);
SearchIterator::UP search(ss);
@@ -49,13 +47,10 @@ SimpleBlueprint::SimpleBlueprint(const SimpleResult &result)
_tag(),
_result(result)
{
- setEstimate(HitEstimate(result.getHitCount(),
- (result.getHitCount() == 0)));
+ setEstimate(HitEstimate(result.getHitCount(), (result.getHitCount() == 0)));
}
-SimpleBlueprint::~SimpleBlueprint()
-{
-}
+SimpleBlueprint::~SimpleBlueprint() = default;
SimpleBlueprint &
SimpleBlueprint::tag(const vespalib::string &t)
@@ -67,30 +62,21 @@ SimpleBlueprint::tag(const vespalib::string &t)
//-----------------------------------------------------------------------------
SearchIterator::UP
-FakeBlueprint::createLeafSearch(const fef::TermFieldMatchDataArray &tfmda,
- bool) const
+FakeBlueprint::createLeafSearch(const fef::TermFieldMatchDataArray &tfmda, bool) const
{
- return SearchIterator::UP(new FakeSearch(_tag, _field.getName(), _term,
- _result, tfmda));
+ return std::make_unique<FakeSearch>(_tag, _field.getName(), _term, _result, tfmda);
}
-FakeBlueprint::FakeBlueprint(const FieldSpec &field,
- const FakeResult &result)
+FakeBlueprint::FakeBlueprint(const FieldSpec &field, const FakeResult &result)
: SimpleLeafBlueprint(field),
_tag("<tag>"),
_term("<term>"),
_field(field),
_result(result)
{
- setEstimate(HitEstimate(result.inspect().size(),
- result.inspect().empty()));
+ setEstimate(HitEstimate(result.inspect().size(), result.inspect().empty()));
}
-FakeBlueprint::~FakeBlueprint()
-{
-}
+FakeBlueprint::~FakeBlueprint() = default;
-//-----------------------------------------------------------------------------
-
-} // namespace queryeval
-} // namespace search
+}
diff --git a/searchlib/src/vespa/searchlib/queryeval/leaf_blueprints.h b/searchlib/src/vespa/searchlib/queryeval/leaf_blueprints.h
index 8da81368c72..d0f3c95f140 100644
--- a/searchlib/src/vespa/searchlib/queryeval/leaf_blueprints.h
+++ b/searchlib/src/vespa/searchlib/queryeval/leaf_blueprints.h
@@ -15,8 +15,7 @@ class EmptyBlueprint : public SimpleLeafBlueprint
{
protected:
SearchIterator::UP
- createLeafSearch(const search::fef::TermFieldMatchDataArray &tfmda,
- bool strict) const override;
+ createLeafSearch(const search::fef::TermFieldMatchDataArray &tfmda, bool strict) const override;
public:
EmptyBlueprint(const FieldSpecBaseList &fields);
@@ -34,8 +33,7 @@ private:
protected:
SearchIterator::UP
- createLeafSearch(const search::fef::TermFieldMatchDataArray &tfmda,
- bool strict) const override;
+ createLeafSearch(const search::fef::TermFieldMatchDataArray &tfmda, bool strict) const override;
public:
SimpleBlueprint(const SimpleResult &result);
@@ -56,12 +54,10 @@ private:
protected:
SearchIterator::UP
- createLeafSearch(const fef::TermFieldMatchDataArray &tfmda,
- bool strict) const override;
+ createLeafSearch(const fef::TermFieldMatchDataArray &tfmda, bool strict) const override;
public:
- FakeBlueprint(const FieldSpec &field,
- const FakeResult &result);
+ FakeBlueprint(const FieldSpec &field, const FakeResult &result);
~FakeBlueprint();
FakeBlueprint &tag(const vespalib::string &t) {
diff --git a/searchlib/src/vespa/searchlib/queryeval/searchable.cpp b/searchlib/src/vespa/searchlib/queryeval/searchable.cpp
index 87d42add0a7..af1908117ab 100644
--- a/searchlib/src/vespa/searchlib/queryeval/searchable.cpp
+++ b/searchlib/src/vespa/searchlib/queryeval/searchable.cpp
@@ -4,8 +4,7 @@
#include "leaf_blueprints.h"
#include "intermediate_blueprints.h"
-namespace search {
-namespace queryeval {
+namespace search::queryeval {
Blueprint::UP
Searchable::createBlueprint(const IRequestContext & requestContext,
@@ -26,5 +25,4 @@ Searchable::createBlueprint(const IRequestContext & requestContext,
return result;
}
-} // namespace queryeval
-} // namespace search
+}
diff --git a/searchlib/src/vespa/searchlib/queryeval/searchable.h b/searchlib/src/vespa/searchlib/queryeval/searchable.h
index 8faef2be08b..ef4c461d11f 100644
--- a/searchlib/src/vespa/searchlib/queryeval/searchable.h
+++ b/searchlib/src/vespa/searchlib/queryeval/searchable.h
@@ -7,11 +7,9 @@
#include <vespa/searchlib/queryeval/irequestcontext.h>
#include <vector>
-namespace search {
+namespace search::query { class Node; }
-namespace query { class Node; }
-
-namespace queryeval {
+namespace search::queryeval {
/**
* Abstract class extended by components to expose content that can be
@@ -56,5 +54,4 @@ public:
virtual ~Searchable() {}
};
-} // namespace queryeval
-} // namespace search
+}
diff --git a/searchlib/src/vespa/searchlib/queryeval/searchiterator.h b/searchlib/src/vespa/searchlib/queryeval/searchiterator.h
index 1c3f5a9513c..63c2afd33aa 100644
--- a/searchlib/src/vespa/searchlib/queryeval/searchiterator.h
+++ b/searchlib/src/vespa/searchlib/queryeval/searchiterator.h
@@ -9,13 +9,11 @@
#include <memory>
#include <vector>
-namespace vespalib { class ObjectVisitor; };
+namespace vespalib { class ObjectVisitor; }
-namespace search {
+namespace search { class BitVector; }
-class BitVector;
-
-namespace queryeval {
+namespace search::queryeval {
/**
* This is the abstract superclass of all search objects. Each search
@@ -342,8 +340,7 @@ public:
};
-} // namespace queryeval
-} // namespace search
+}
void visit(vespalib::ObjectVisitor &self, const vespalib::string &name,
const search::queryeval::SearchIterator &obj);
diff --git a/searchlib/src/vespa/searchlib/queryeval/simple_phrase_blueprint.h b/searchlib/src/vespa/searchlib/queryeval/simple_phrase_blueprint.h
index 88060653312..d0e3868f34a 100644
--- a/searchlib/src/vespa/searchlib/queryeval/simple_phrase_blueprint.h
+++ b/searchlib/src/vespa/searchlib/queryeval/simple_phrase_blueprint.h
@@ -6,10 +6,9 @@
#include "irequestcontext.h"
#include <vespa/searchlib/fef/matchdatalayout.h>
-namespace search {
-namespace fef { class TermFieldMatchData; }
+namespace search::fef { class TermFieldMatchData; }
-namespace queryeval {
+namespace search::queryeval {
class SimplePhraseBlueprint : public ComplexLeafBlueprint
{
@@ -40,5 +39,4 @@ public:
void fetchPostings(bool strict) override;
};
-} // namespace search::queryeval
-} // namespace search
+}
diff --git a/searchlib/src/vespa/searchlib/queryeval/split_float.cpp b/searchlib/src/vespa/searchlib/queryeval/split_float.cpp
index 62afeecc1a1..69f62368e67 100644
--- a/searchlib/src/vespa/searchlib/queryeval/split_float.cpp
+++ b/searchlib/src/vespa/searchlib/queryeval/split_float.cpp
@@ -3,8 +3,7 @@
#include "split_float.h"
#include <cctype>
-namespace search {
-namespace queryeval {
+namespace search::queryeval {
SplitFloat::SplitFloat(const vespalib::string &input)
{
@@ -23,5 +22,5 @@ SplitFloat::SplitFloat(const vespalib::string &input)
}
}
-} // namespace search::queryeval
-} // namespace search
+}
+
diff --git a/searchlib/src/vespa/searchlib/queryeval/split_float.h b/searchlib/src/vespa/searchlib/queryeval/split_float.h
index 2c9f034bc9e..b55ba73e563 100644
--- a/searchlib/src/vespa/searchlib/queryeval/split_float.h
+++ b/searchlib/src/vespa/searchlib/queryeval/split_float.h
@@ -6,8 +6,7 @@
#include <vector>
#include <vespa/vespalib/stllike/string.h>
-namespace search {
-namespace queryeval {
+namespace search::queryeval {
class SplitFloat
{
@@ -19,6 +18,4 @@ public:
const vespalib::string &getPart(size_t i) const { return _parts[i]; }
};
-} // namespace search::queryeval
-} // namespace search
-
+}
diff --git a/searchlib/src/vespa/searchlib/queryeval/termasstring.cpp b/searchlib/src/vespa/searchlib/queryeval/termasstring.cpp
index 8dff666e7eb..14a6cefaf1b 100644
--- a/searchlib/src/vespa/searchlib/queryeval/termasstring.cpp
+++ b/searchlib/src/vespa/searchlib/queryeval/termasstring.cpp
@@ -37,8 +37,7 @@ using search::query::DotProduct;
using search::query::WandTerm;
using vespalib::string;
-namespace search {
-namespace queryeval {
+namespace search::queryeval {
vespalib::string termAsString(double float_term) {
vespalib::asciistream os;
@@ -114,5 +113,4 @@ string termAsString(const Node &term_node) {
return visitor.term;
}
-} // namespace search::queryeval
-} // namespace search
+}
diff --git a/searchlib/src/vespa/searchlib/queryeval/termasstring.h b/searchlib/src/vespa/searchlib/queryeval/termasstring.h
index 310ce19bb8e..c40050f0e2b 100644
--- a/searchlib/src/vespa/searchlib/queryeval/termasstring.h
+++ b/searchlib/src/vespa/searchlib/queryeval/termasstring.h
@@ -6,10 +6,9 @@
#include <vespa/searchlib/query/tree/range.h>
#include <string>
-namespace search {
-namespace query { class Node; }
+namespace search::query { class Node; }
-namespace queryeval {
+namespace search::queryeval {
inline const vespalib::string &termAsString(const vespalib::string &term) {
return term;
@@ -25,6 +24,4 @@ vespalib::string termAsString(const search::query::Location &term);
vespalib::string termAsString(const search::query::Node &term_node);
-} // namespace search::queryeval
-} // namespace search
-
+}
diff --git a/searchlib/src/vespa/searchlib/queryeval/weighted_set_term_blueprint.h b/searchlib/src/vespa/searchlib/queryeval/weighted_set_term_blueprint.h
index b81d6c6f9e9..19e88466b1a 100644
--- a/searchlib/src/vespa/searchlib/queryeval/weighted_set_term_blueprint.h
+++ b/searchlib/src/vespa/searchlib/queryeval/weighted_set_term_blueprint.h
@@ -4,13 +4,11 @@
#include "searchable.h"
#include <vespa/searchlib/fef/matchdatalayout.h>
-#include <memory>
#include <vector>
-namespace search {
-namespace fef { class TermFieldMatchData; }
+namespace search::fef { class TermFieldMatchData; }
-namespace queryeval {
+namespace search::queryeval {
class WeightedSetTermBlueprint : public ComplexLeafBlueprint
{
@@ -35,13 +33,12 @@ public:
// used by create visitor
void addTerm(Blueprint::UP term, int32_t weight);
- SearchIteratorUP createLeafSearch(const search::fef::TermFieldMatchDataArray &tfmda, bool strict) const override;
+ SearchIteratorUP createLeafSearch(const fef::TermFieldMatchDataArray &tfmda, bool strict) const override;
void visitMembers(vespalib::ObjectVisitor &visitor) const override;
private:
void fetchPostings(bool strict) override;
};
-} // namespace search::queryeval
-} // namespace search
+}