aboutsummaryrefslogtreecommitdiffstats
path: root/searchlib
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@oath.com>2018-05-25 09:47:23 +0200
committerHenning Baldersheim <balder@oath.com>2018-05-25 09:47:23 +0200
commit857b1380d3d39d3667bf7ee87daa119455bccda2 (patch)
tree975d738a16b6abb4754c988094a72fcbbc32fefc /searchlib
parent74d4cb5cde9e07b713da891d78a70b1113596feb (diff)
Add some simple SameElement testing.
Diffstat (limited to 'searchlib')
-rw-r--r--searchlib/src/tests/query/querybuilder_test.cpp12
-rw-r--r--searchlib/src/vespa/searchlib/features/distancetopathfeature.cpp10
-rw-r--r--searchlib/src/vespa/searchlib/features/distancetopathfeature.h9
-rw-r--r--searchlib/src/vespa/searchlib/query/tree/intermediate.h2
-rw-r--r--searchlib/src/vespa/searchlib/query/tree/intermediatenodes.h1
-rw-r--r--searchlib/src/vespa/searchlib/query/tree/querybuilder.h5
-rw-r--r--searchlib/src/vespa/searchlib/query/tree/term.cpp11
-rw-r--r--searchlib/src/vespa/searchlib/query/tree/term.h15
-rw-r--r--searchlib/src/vespa/searchlib/query/weight.h6
-rw-r--r--searchlib/src/vespa/searchlib/queryeval/create_blueprint_visitor_helper.cpp2
10 files changed, 30 insertions, 43 deletions
diff --git a/searchlib/src/tests/query/querybuilder_test.cpp b/searchlib/src/tests/query/querybuilder_test.cpp
index 37c97d69980..9753072cdf7 100644
--- a/searchlib/src/tests/query/querybuilder_test.cpp
+++ b/searchlib/src/tests/query/querybuilder_test.cpp
@@ -1,22 +1,18 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
// Unit tests for querybuilder.
-#include <vespa/log/log.h>
-LOG_SETUP("querybuilder_test");
-
#include <vespa/searchlib/parsequery/parse.h>
#include <vespa/searchlib/parsequery/simplequerystack.h>
#include <vespa/searchlib/query/tree/customtypevisitor.h>
-#include <vespa/searchlib/query/tree/intermediatenodes.h>
#include <vespa/searchlib/query/tree/point.h>
#include <vespa/searchlib/query/tree/querybuilder.h>
-#include <vespa/searchlib/query/tree/querytreecreator.h>
#include <vespa/searchlib/query/tree/simplequery.h>
#include <vespa/searchlib/query/tree/stackdumpcreator.h>
-#include <vespa/searchlib/query/tree/termnodes.h>
-#include <vespa/searchlib/util/rawbuf.h>
#include <vespa/vespalib/testkit/test_kit.h>
-#include <string>
+
+#include <vespa/log/log.h>
+LOG_SETUP("querybuilder_test");
+#include <vespa/searchlib/query/tree/querytreecreator.h>
using std::string;
using search::SimpleQueryStackDumpIterator;
diff --git a/searchlib/src/vespa/searchlib/features/distancetopathfeature.cpp b/searchlib/src/vespa/searchlib/features/distancetopathfeature.cpp
index 4f4491327e7..834f5913af9 100644
--- a/searchlib/src/vespa/searchlib/features/distancetopathfeature.cpp
+++ b/searchlib/src/vespa/searchlib/features/distancetopathfeature.cpp
@@ -14,8 +14,7 @@
#include <vespa/log/log.h>
LOG_SETUP(".features.distancetopathfeature");
-namespace search {
-namespace features {
+namespace search::features {
const feature_t DistanceToPathExecutor::DEFAULT_DISTANCE(6400000000.0);
@@ -96,9 +95,7 @@ DistanceToPathBlueprint::DistanceToPathBlueprint() :
{
}
-DistanceToPathBlueprint::~DistanceToPathBlueprint()
-{
-}
+DistanceToPathBlueprint::~DistanceToPathBlueprint() = default;
void
DistanceToPathBlueprint::visitDumpFeatures(const search::fef::IIndexEnvironment &,
@@ -175,5 +172,4 @@ DistanceToPathBlueprint::createExecutor(const search::fef::IQueryEnvironment &en
return stash.create<DistanceToPathExecutor>(path, pos);
}
-} // namespace features
-} // namespace search
+}
diff --git a/searchlib/src/vespa/searchlib/features/distancetopathfeature.h b/searchlib/src/vespa/searchlib/features/distancetopathfeature.h
index cf268c59a2e..442f1ba3b28 100644
--- a/searchlib/src/vespa/searchlib/features/distancetopathfeature.h
+++ b/searchlib/src/vespa/searchlib/features/distancetopathfeature.h
@@ -6,8 +6,7 @@
#include <vespa/searchlib/fef/featureexecutor.h>
#include <vespa/searchlib/common/feature.h>
-namespace search {
-namespace features {
+namespace search::features {
/**
* Define the point type that makes up the end-points in our path.
@@ -52,7 +51,7 @@ private:
public:
DistanceToPathBlueprint();
- ~DistanceToPathBlueprint();
+ ~DistanceToPathBlueprint() override;
void visitDumpFeatures(const fef::IIndexEnvironment &env, fef::IDumpFeatureVisitor &visitor) const override;
fef::Blueprint::UP createInstance() const override;
fef::ParameterDescriptions getDescriptions() const override {
@@ -64,6 +63,4 @@ public:
};
-} // namespace features
-} // namespace search
-
+}
diff --git a/searchlib/src/vespa/searchlib/query/tree/intermediate.h b/searchlib/src/vespa/searchlib/query/tree/intermediate.h
index 9fac7345436..052dc1db269 100644
--- a/searchlib/src/vespa/searchlib/query/tree/intermediate.h
+++ b/searchlib/src/vespa/searchlib/query/tree/intermediate.h
@@ -1,8 +1,8 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
+#include "node.h"
#include <vector>
-#include <vespa/searchlib/query/tree/node.h>
namespace search::query {
diff --git a/searchlib/src/vespa/searchlib/query/tree/intermediatenodes.h b/searchlib/src/vespa/searchlib/query/tree/intermediatenodes.h
index f53e5aed031..93b4000b6c3 100644
--- a/searchlib/src/vespa/searchlib/query/tree/intermediatenodes.h
+++ b/searchlib/src/vespa/searchlib/query/tree/intermediatenodes.h
@@ -5,7 +5,6 @@
#include "intermediate.h"
#include "querynodemixin.h"
#include "term.h"
-#include <vespa/searchlib/query/weight.h>
namespace search::query {
diff --git a/searchlib/src/vespa/searchlib/query/tree/querybuilder.h b/searchlib/src/vespa/searchlib/query/tree/querybuilder.h
index 583966bcfc5..b6a755ddb97 100644
--- a/searchlib/src/vespa/searchlib/query/tree/querybuilder.h
+++ b/searchlib/src/vespa/searchlib/query/tree/querybuilder.h
@@ -20,10 +20,9 @@
#pragma once
#include "predicate_query_term.h"
-#include <stack>
-#include <vespa/vespalib/stllike/string.h>
-#include <vespa/searchlib/query/weight.h>
#include "node.h"
+#include <vespa/searchlib/query/weight.h>
+#include <stack>
namespace search::query {
diff --git a/searchlib/src/vespa/searchlib/query/tree/term.cpp b/searchlib/src/vespa/searchlib/query/tree/term.cpp
index 924f562760a..de59752aa10 100644
--- a/searchlib/src/vespa/searchlib/query/tree/term.cpp
+++ b/searchlib/src/vespa/searchlib/query/tree/term.cpp
@@ -1,6 +1,7 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "term.h"
+#include <cassert>
namespace search::query {
@@ -15,4 +16,14 @@ Term::Term(const vespalib::stringref &view, int32_t id, Weight weight) :
_position_data(true)
{ }
+void Term::setStateFrom(const Term& other) {
+ setTermIndex(other.getTermIndex());
+ setRanked(other.isRanked());
+ setPositionData(other.usePositionData());
+ // too late to copy this state:
+ assert(_view == other.getView());
+ assert(_id == other.getId());
+ assert(_weight == other.getWeight());
+}
+
}
diff --git a/searchlib/src/vespa/searchlib/query/tree/term.h b/searchlib/src/vespa/searchlib/query/tree/term.h
index f172267ee98..8e9b9897e9d 100644
--- a/searchlib/src/vespa/searchlib/query/tree/term.h
+++ b/searchlib/src/vespa/searchlib/query/tree/term.h
@@ -1,10 +1,9 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
-#include <vespa/vespalib/stllike/string.h>
-#include <vespa/searchlib/query/tree/node.h>
+#include "node.h"
#include <vespa/searchlib/query/weight.h>
-#include <cassert>
+#include <vespa/vespalib/stllike/string.h>
namespace search::query {
@@ -28,15 +27,7 @@ public:
void setRanked(bool ranked) { _ranked = ranked; }
void setPositionData(bool position_data) { _position_data = position_data; }
- void setStateFrom(const Term& other) {
- setTermIndex(other.getTermIndex());
- setRanked(other.isRanked());
- setPositionData(other.usePositionData());
- // too late to copy this state:
- assert(_view == other.getView());
- assert(_id == other.getId());
- assert(_weight == other.getWeight());
- }
+ void setStateFrom(const Term& other);
const vespalib::string & getView() const { return _view; }
Weight getWeight() const { return _weight; }
diff --git a/searchlib/src/vespa/searchlib/query/weight.h b/searchlib/src/vespa/searchlib/query/weight.h
index 1b4168231c5..51596642cd2 100644
--- a/searchlib/src/vespa/searchlib/query/weight.h
+++ b/searchlib/src/vespa/searchlib/query/weight.h
@@ -3,8 +3,7 @@
#include <cstdint>
-namespace search {
-namespace query {
+namespace search::query {
/**
* Represents the weight given on a query item such as a term, phrase, or equiv.
@@ -44,8 +43,7 @@ public:
bool operator== (const Weight& other) const { return _weight == other._weight; }
};
-} // namespace query
-} // namespace search
+}
inline search::query::Weight operator+(const search::query::Weight& a, const search::query::Weight& b)
{
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 09d99a77d39..3997f7d36f3 100644
--- a/searchlib/src/vespa/searchlib/queryeval/create_blueprint_visitor_helper.cpp
+++ b/searchlib/src/vespa/searchlib/queryeval/create_blueprint_visitor_helper.cpp
@@ -44,7 +44,7 @@ CreateBlueprintVisitorHelper::visitPhrase(query::Phrase &n) {
void
CreateBlueprintVisitorHelper::visitSameElement(query::SameElement &n) {
(void) n;
- //TODO Implement Blueprint creation.
+ //TODO Implement SameElementBlueprint creation.
}
void