diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2016-06-24 09:16:57 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2016-06-24 09:16:57 +0000 |
commit | 9c4e6c07696fc7ea5322105ed23427ba5c5b91b9 (patch) | |
tree | 83b4670cc880b2bbbb12df24ba1d505ab691ae37 /searchlib | |
parent | 1cee672df5ac410fbf54975e518f799367997785 (diff) |
countMatches -> matchCount
Diffstat (limited to 'searchlib')
-rw-r--r-- | searchlib/src/tests/features/prod_features.cpp | 28 | ||||
-rw-r--r-- | searchlib/src/tests/features/prod_features.h | 2 | ||||
-rw-r--r-- | searchlib/src/vespa/searchlib/features/CMakeLists.txt | 2 | ||||
-rw-r--r-- | searchlib/src/vespa/searchlib/features/matchcountfeature.cpp (renamed from searchlib/src/vespa/searchlib/features/countmatchesfeature.cpp) | 24 | ||||
-rw-r--r-- | searchlib/src/vespa/searchlib/features/matchcountfeature.h (renamed from searchlib/src/vespa/searchlib/features/countmatchesfeature.h) | 14 | ||||
-rw-r--r-- | searchlib/src/vespa/searchlib/features/setup.cpp | 4 |
6 files changed, 37 insertions, 37 deletions
diff --git a/searchlib/src/tests/features/prod_features.cpp b/searchlib/src/tests/features/prod_features.cpp index c459d546599..43f3174b994 100644 --- a/searchlib/src/tests/features/prod_features.cpp +++ b/searchlib/src/tests/features/prod_features.cpp @@ -9,7 +9,6 @@ LOG_SETUP("prod_features_test"); #include <vespa/searchlib/attribute/attributefactory.h> #include <vespa/searchlib/attribute/attributevector.h> #include <vespa/searchlib/attribute/attributevector.hpp> -#include <vespa/searchlib/features/countmatchesfeature.h> #include <vespa/searchlib/attribute/extendableattributes.h> #include <vespa/searchlib/attribute/floatbase.h> #include <vespa/searchlib/attribute/integerbase.h> @@ -27,6 +26,7 @@ LOG_SETUP("prod_features_test"); #include <vespa/searchlib/features/firstphasefeature.h> #include <vespa/searchlib/features/foreachfeature.h> #include <vespa/searchlib/features/freshnessfeature.h> +#include <vespa/searchlib/features/matchcountfeature.h> #include <vespa/searchlib/features/matchesfeature.h> #include <vespa/searchlib/features/matchfeature.h> #include <vespa/searchlib/features/nowfeature.h> @@ -88,7 +88,7 @@ Test::Main() TEST_DO(testAttribute()); TEST_FLUSH(); TEST_DO(testAttributeMatch()); TEST_FLUSH(); TEST_DO(testCloseness()); TEST_FLUSH(); - TEST_DO(testCountMatches()); TEST_FLUSH(); + TEST_DO(testMatchCount()); TEST_FLUSH(); TEST_DO(testDistance()); TEST_FLUSH(); TEST_DO(testDistanceToPath()); TEST_FLUSH(); TEST_DO(testDotProduct()); TEST_FLUSH(); @@ -1459,12 +1459,12 @@ Test::testMatch() } void -Test::testCountMatches() +Test::testMatchCount() { { // Test blueprint. - CountMatchesBlueprint pt; + MatchCountBlueprint pt; - EXPECT_TRUE(assertCreateInstance(pt, "countMatches")); + EXPECT_TRUE(assertCreateInstance(pt, "matchCount")); FtFeatureTest ft(_factory, ""); ft.getIndexEnv().getBuilder().addField(FieldType::INDEX, CollectionType::SINGLE, "foo"); @@ -1476,18 +1476,18 @@ Test::testCountMatches() FT_SETUP_OK(pt, ft.getIndexEnv(), params.clear().add("foo"), in, out.add("out")); FT_SETUP_OK(pt, ft.getIndexEnv(), params.clear().add("bar"), in, out); - FT_DUMP_EMPTY(_factory, "countMatches"); + FT_DUMP_EMPTY(_factory, "matchCount"); } { // Test executor for index fields - EXPECT_TRUE(assertMatches(0, "x", "a", "countMatches(foo)")); - EXPECT_TRUE(assertMatches(1, "a", "a", "countMatches(foo)")); - EXPECT_TRUE(assertMatches(2, "a b", "a b", "countMatches(foo)")); + EXPECT_TRUE(assertMatches(0, "x", "a", "matchCount(foo)")); + EXPECT_TRUE(assertMatches(1, "a", "a", "matchCount(foo)")); + EXPECT_TRUE(assertMatches(2, "a b", "a b", "matchCount(foo)")); // change docId to indicate no matches in the field - EXPECT_TRUE(assertMatches(0, "a", "a", "countMatches(foo)", 2)); + EXPECT_TRUE(assertMatches(0, "a", "a", "matchCount(foo)", 2)); } { // Test executor for attribute fields - FtFeatureTest ft(_factory, StringList().add("countMatches(foo)"). - add("countMatches(baz)")); + FtFeatureTest ft(_factory, StringList().add("matchCount(foo)"). + add("matchCount(baz)")); ft.getIndexEnv().getBuilder().addField(FieldType::ATTRIBUTE, CollectionType::SINGLE, "foo"); ft.getIndexEnv().getBuilder().addField(FieldType::ATTRIBUTE, CollectionType::SINGLE, "bar"); ft.getIndexEnv().getBuilder().addField(FieldType::ATTRIBUTE, CollectionType::SINGLE, "baz"); @@ -1501,8 +1501,8 @@ Test::testCountMatches() mdb->setWeight("bar", 1, 0); mdb->setWeight("foo", 2, 0); mdb->apply(1); - EXPECT_TRUE(ft.execute(RankResult().addScore("countMatches(foo)", 2))); - EXPECT_TRUE(ft.execute(RankResult().addScore("countMatches(baz)", 0))); + EXPECT_TRUE(ft.execute(RankResult().addScore("matchCount(foo)", 2))); + EXPECT_TRUE(ft.execute(RankResult().addScore("matchCount(baz)", 0))); } } diff --git a/searchlib/src/tests/features/prod_features.h b/searchlib/src/tests/features/prod_features.h index ac49897eceb..00c1fa46ec8 100644 --- a/searchlib/src/tests/features/prod_features.h +++ b/searchlib/src/tests/features/prod_features.h @@ -16,7 +16,7 @@ public: void testAttribute(); void testAttributeMatch(); void testCloseness(); - void testCountMatches(); + void testMatchCount(); void testDistance(); void testDistanceToPath(); void testDotProduct(); diff --git a/searchlib/src/vespa/searchlib/features/CMakeLists.txt b/searchlib/src/vespa/searchlib/features/CMakeLists.txt index 7bbf436dac1..2ce9fc6886c 100644 --- a/searchlib/src/vespa/searchlib/features/CMakeLists.txt +++ b/searchlib/src/vespa/searchlib/features/CMakeLists.txt @@ -6,7 +6,6 @@ vespa_add_library(searchlib_features OBJECT attributefeature.cpp attributematchfeature.cpp closenessfeature.cpp - countmatchesfeature.cpp debug_attribute_wait.cpp debug_wait.cpp distancefeature.cpp @@ -25,6 +24,7 @@ vespa_add_library(searchlib_features OBJECT freshnessfeature.cpp item_raw_score_feature.cpp jarowinklerdistancefeature.cpp + matchcountfeature.cpp matchesfeature.cpp matchfeature.cpp native_dot_product_feature.cpp diff --git a/searchlib/src/vespa/searchlib/features/countmatchesfeature.cpp b/searchlib/src/vespa/searchlib/features/matchcountfeature.cpp index 84d507a32d9..b9b84bb97c2 100644 --- a/searchlib/src/vespa/searchlib/features/countmatchesfeature.cpp +++ b/searchlib/src/vespa/searchlib/features/matchcountfeature.cpp @@ -2,19 +2,19 @@ #include <vespa/fastos/fastos.h> #include <vespa/searchlib/fef/fieldinfo.h> -#include "countmatchesfeature.h" +#include "matchcountfeature.h" #include "utils.h" #include "valuefeature.h" #include <vespa/log/log.h> -LOG_SETUP(".features.countmatchesfeature"); +LOG_SETUP(".features.matchcountfeature"); using namespace search::fef; namespace search { namespace features { -CountMatchesExecutor::CountMatchesExecutor(uint32_t fieldId, const IQueryEnvironment &env) +MatchCountExecutor::MatchCountExecutor(uint32_t fieldId, const IQueryEnvironment &env) : FeatureExecutor(), _handles() { @@ -27,7 +27,7 @@ CountMatchesExecutor::CountMatchesExecutor(uint32_t fieldId, const IQueryEnviron } void -CountMatchesExecutor::execute(MatchData &match) +MatchCountExecutor::execute(MatchData &match) { size_t output = 0; for (uint32_t i = 0; i < _handles.size(); ++i) { @@ -40,19 +40,19 @@ CountMatchesExecutor::execute(MatchData &match) } -CountMatchesBlueprint::CountMatchesBlueprint() : - Blueprint("countMatches"), +MatchCountBlueprint::MatchCountBlueprint() : + Blueprint("matchCount"), _field(NULL) { } void -CountMatchesBlueprint::visitDumpFeatures(const IIndexEnvironment &, IDumpFeatureVisitor &) const +MatchCountBlueprint::visitDumpFeatures(const IIndexEnvironment &, IDumpFeatureVisitor &) const { } bool -CountMatchesBlueprint::setup(const IIndexEnvironment &, const ParameterList & params) +MatchCountBlueprint::setup(const IIndexEnvironment &, const ParameterList & params) { _field = params[0].asField(); describeOutput("out", "Returns number of matches in the field of all terms in the query"); @@ -60,18 +60,18 @@ CountMatchesBlueprint::setup(const IIndexEnvironment &, const ParameterList & pa } Blueprint::UP -CountMatchesBlueprint::createInstance() const +MatchCountBlueprint::createInstance() const { - return Blueprint::UP(new CountMatchesBlueprint()); + return Blueprint::UP(new MatchCountBlueprint()); } FeatureExecutor::LP -CountMatchesBlueprint::createExecutor(const IQueryEnvironment & queryEnv) const +MatchCountBlueprint::createExecutor(const IQueryEnvironment & queryEnv) const { if (_field == nullptr) { return FeatureExecutor::LP(new ValueExecutor(std::vector<feature_t>(1, 0.0))); } - return FeatureExecutor::LP(new CountMatchesExecutor(_field->id(), queryEnv)); + return FeatureExecutor::LP(new MatchCountExecutor(_field->id(), queryEnv)); } } // namespace features diff --git a/searchlib/src/vespa/searchlib/features/countmatchesfeature.h b/searchlib/src/vespa/searchlib/features/matchcountfeature.h index c258d46ca90..2f831dcf9a3 100644 --- a/searchlib/src/vespa/searchlib/features/countmatchesfeature.h +++ b/searchlib/src/vespa/searchlib/features/matchcountfeature.h @@ -9,32 +9,32 @@ namespace search { namespace features { /** - * Implements the executor for the countMatches feature for index and + * Implements the executor for the matchCount feature for index and * attribute fields. */ -class CountMatchesExecutor : public fef::FeatureExecutor +class MatchCountExecutor : public fef::FeatureExecutor { private: std::vector<fef::TermFieldHandle> _handles; public: - CountMatchesExecutor(uint32_t fieldId, const fef::IQueryEnvironment &env); + MatchCountExecutor(uint32_t fieldId, const fef::IQueryEnvironment &env); void execute(fef::MatchData & data) override; }; /** - * Implements the blueprint for the countMatches executor. + * Implements the blueprint for the matchCount executor. * - * countMatches(name) + * matchCount(name) * - returns number of matches of the query in the particular field. */ -class CountMatchesBlueprint : public fef::Blueprint +class MatchCountBlueprint : public fef::Blueprint { private: const fef::FieldInfo *_field; public: - CountMatchesBlueprint(); + MatchCountBlueprint(); void visitDumpFeatures(const fef::IIndexEnvironment & env, fef::IDumpFeatureVisitor & visitor) const override; diff --git a/searchlib/src/vespa/searchlib/features/setup.cpp b/searchlib/src/vespa/searchlib/features/setup.cpp index 73727624994..7c98fc8c1ea 100644 --- a/searchlib/src/vespa/searchlib/features/setup.cpp +++ b/searchlib/src/vespa/searchlib/features/setup.cpp @@ -6,7 +6,6 @@ #include "attributefeature.h" #include "attributematchfeature.h" #include "closenessfeature.h" -#include "countmatchesfeature.h" #include "debug_attribute_wait.h" #include "debug_wait.h" #include "distancefeature.h" @@ -25,6 +24,7 @@ #include "freshnessfeature.h" #include "item_raw_score_feature.h" #include "jarowinklerdistancefeature.h" +#include "matchcountfeature.h" #include "matchesfeature.h" #include "matchfeature.h" #include "native_dot_product_feature.h" @@ -64,7 +64,7 @@ void setup_search_features(fef::IBlueprintRegistry & registry) registry.addPrototype(Blueprint::SP(new AttributeBlueprint())); registry.addPrototype(Blueprint::SP(new AttributeMatchBlueprint())); registry.addPrototype(Blueprint::SP(new ClosenessBlueprint())); - registry.addPrototype(Blueprint::SP(new CountMatchesBlueprint())); + registry.addPrototype(Blueprint::SP(new MatchCountBlueprint())); registry.addPrototype(Blueprint::SP(new DistanceBlueprint())); registry.addPrototype(Blueprint::SP(new DistanceToPathBlueprint())); registry.addPrototype(Blueprint::SP(new DebugAttributeWaitBlueprint())); |