From cea23ae0ad6f0cf114b7adc5f35a9d9f13465e9a Mon Sep 17 00:00:00 2001 From: Haavard Date: Wed, 14 Dec 2016 09:55:37 +0000 Subject: remove features from match data --- .../searchable/attributeblueprint_test.cpp | 2 +- .../src/tests/features/prod_features_framework.cpp | 1 - searchlib/src/tests/fef/fef_test.cpp | 10 ---- .../tests/queryeval/blueprint/blueprint_test.cpp | 2 +- .../blueprint/intermediate_blueprints_test.cpp | 14 ++--- .../queryeval/blueprint/leaf_blueprints_test.cpp | 6 +-- .../queryeval/dot_product/dot_product_test.cpp | 4 +- searchlib/src/tests/queryeval/equiv/equiv_test.cpp | 2 +- .../fake_searchable/fake_searchable_test.cpp | 10 ++-- .../parallel_weak_and/parallel_weak_and_test.cpp | 4 +- searchlib/src/tests/queryeval/queryeval.cpp | 12 ++--- .../queryeval/simple_phrase/simple_phrase_test.cpp | 2 +- .../queryeval/sourceblender/sourceblender.cpp | 2 +- .../queryeval/termwise_eval/termwise_eval_test.cpp | 3 +- .../src/vespa/searchlib/fef/featureexecutor.h | 1 + searchlib/src/vespa/searchlib/fef/matchdata.cpp | 8 ++- searchlib/src/vespa/searchlib/fef/matchdata.h | 59 +--------------------- .../src/vespa/searchlib/fef/matchdatalayout.cpp | 11 +--- .../src/vespa/searchlib/fef/matchdatalayout.h | 14 ----- searchlib/src/vespa/searchlib/fef/rank_program.cpp | 2 +- .../src/tests/hitcollector/hitcollector.cpp | 6 +-- 21 files changed, 42 insertions(+), 133 deletions(-) diff --git a/searchlib/src/tests/attribute/searchable/attributeblueprint_test.cpp b/searchlib/src/tests/attribute/searchable/attributeblueprint_test.cpp index 21fbedec5be..6d36dc6bb63 100644 --- a/searchlib/src/tests/attribute/searchable/attributeblueprint_test.cpp +++ b/searchlib/src/tests/attribute/searchable/attributeblueprint_test.cpp @@ -123,7 +123,7 @@ bool Test::search(const string &term, IAttributeManager &attribute_manager) { bool Test::search(const Node &node, IAttributeManager &attribute_manager) { AttributeContext ac(attribute_manager); FakeRequestContext requestContext(&ac); - MatchData::UP md(MatchData::makeTestInstance(0, 1, 1)); + MatchData::UP md(MatchData::makeTestInstance(1, 1)); AttributeBlueprintFactory source; Blueprint::UP result = source.createBlueprint(requestContext, FieldSpec(field, 0, 0), node); ASSERT_TRUE(result.get()); diff --git a/searchlib/src/tests/features/prod_features_framework.cpp b/searchlib/src/tests/features/prod_features_framework.cpp index 5ce5e2c3177..30a48ce61f4 100644 --- a/searchlib/src/tests/features/prod_features_framework.cpp +++ b/searchlib/src/tests/features/prod_features_framework.cpp @@ -77,7 +77,6 @@ Test::testFramework() MatchData::UP data = layout.createMatchData(); EXPECT_EQUAL(data->getNumTermFields(), 4u); - EXPECT_EQUAL(data->getNumFeatures(), 0u); { // check match data access MatchDataBuilder mdb(queryEnv, *data); diff --git a/searchlib/src/tests/fef/fef_test.cpp b/searchlib/src/tests/fef/fef_test.cpp index 56ea31a601b..dac63ac1b83 100644 --- a/searchlib/src/tests/fef/fef_test.cpp +++ b/searchlib/src/tests/fef/fef_test.cpp @@ -31,13 +31,9 @@ Test::testLayout() EXPECT_EQUAL(mdl.allocTermField(0), 0u); EXPECT_EQUAL(mdl.allocTermField(42), 1u); EXPECT_EQUAL(mdl.allocTermField(IllegalFieldId), 2u); - EXPECT_EQUAL(mdl.allocFeature(), 0u); - EXPECT_EQUAL(mdl.allocFeature(), 1u); - EXPECT_EQUAL(mdl.allocFeature(), 2u); MatchData::UP md = mdl.createMatchData(); EXPECT_EQUAL(md->getNumTermFields(), 3u); - EXPECT_EQUAL(md->getNumFeatures(), 3u); TermFieldMatchData *t0 = md->resolveTermField(0); TermFieldMatchData *t1 = md->resolveTermField(1); TermFieldMatchData *t2 = md->resolveTermField(2); @@ -46,12 +42,6 @@ Test::testLayout() EXPECT_EQUAL(0u, t0->getFieldId()); EXPECT_EQUAL(42u, t1->getFieldId()); EXPECT_EQUAL(IllegalFieldId, t2->getFieldId()); - feature_t *f0 = md->resolveFeature(0); - feature_t *f1 = md->resolveFeature(1); - feature_t *f2 = md->resolveFeature(2); - EXPECT_EQUAL(f1, f0 + 1); - EXPECT_EQUAL(f2, f1 + 1); - EXPECT_TRUE((void*)t2 < (void*)f0 || (void*)f2 < (void*)t0); } void diff --git a/searchlib/src/tests/queryeval/blueprint/blueprint_test.cpp b/searchlib/src/tests/queryeval/blueprint/blueprint_test.cpp index 7fcb1c20932..e8c2a20a21a 100644 --- a/searchlib/src/tests/queryeval/blueprint/blueprint_test.cpp +++ b/searchlib/src/tests/queryeval/blueprint/blueprint_test.cpp @@ -162,7 +162,7 @@ private: public: Test() : vespalib::TestApp(), - _md(MatchData::makeTestInstance(0, 100, 10)) + _md(MatchData::makeTestInstance(100, 10)) { } Blueprint::UP buildBlueprint1(); diff --git a/searchlib/src/tests/queryeval/blueprint/intermediate_blueprints_test.cpp b/searchlib/src/tests/queryeval/blueprint/intermediate_blueprints_test.cpp index 62bbee6e08c..ae856f7d4a0 100644 --- a/searchlib/src/tests/queryeval/blueprint/intermediate_blueprints_test.cpp +++ b/searchlib/src/tests/queryeval/blueprint/intermediate_blueprints_test.cpp @@ -1043,7 +1043,7 @@ TEST("test WeakAnd Blueprint") { FakeResult z = FakeResult().doc(1).doc(4); { WeakAndBlueprint wa(456); - MatchData::UP md = MatchData::makeTestInstance(0, 100, 10); + MatchData::UP md = MatchData::makeTestInstance(100, 10); wa.addTerm(Blueprint::UP(new FakeBlueprint(field, x)), 120); wa.addTerm(Blueprint::UP(new FakeBlueprint(field, z)), 140); wa.addTerm(Blueprint::UP(new FakeBlueprint(field, y)), 130); @@ -1099,7 +1099,7 @@ TEST("require_that_unpack_of_or_over_multisearch_is_optimized") { ap((new OrBlueprint())-> addChild(std::move(child1)). addChild(std::move(child2)))); - MatchData::UP md = MatchData::makeTestInstance(0, 100, 10); + MatchData::UP md = MatchData::makeTestInstance(100, 10); top_up->fetchPostings(false); EXPECT_EQUAL("search::queryeval::OrLikeSearch", top_up->createSearch(*md, false)->getClassName()); @@ -1125,7 +1125,7 @@ TEST("require_that_unpack_of_or_is_optimized") { addChild(ap(MyLeafSpec(20).addField(1,1).create())). addChild(ap(MyLeafSpec(20).addField(2,2).create())). addChild(ap(MyLeafSpec(10).addField(3,3).create())))); - MatchData::UP md = MatchData::makeTestInstance(0, 100, 10); + MatchData::UP md = MatchData::makeTestInstance(100, 10); top_up->fetchPostings(false); EXPECT_EQUAL("search::queryeval::OrLikeSearch", top_up->createSearch(*md, false)->getClassName()); @@ -1144,7 +1144,7 @@ TEST("require_that_unpack_of_and_is_optimized") { addChild(ap(MyLeafSpec(20).addField(1,1).create())). addChild(ap(MyLeafSpec(20).addField(2,2).create())). addChild(ap(MyLeafSpec(10).addField(3,3).create())))); - MatchData::UP md = MatchData::makeTestInstance(0, 100, 10); + MatchData::UP md = MatchData::makeTestInstance(100, 10); top_up->fetchPostings(false); EXPECT_EQUAL("search::queryeval::AndSearchNoStrict", top_up->createSearch(*md, false)->getClassName()); @@ -1164,7 +1164,7 @@ TEST("require_that_unpack_optimization_is_honoured_by_parents") { addChild(ap(MyLeafSpec(20).addField(1,1).create())). addChild(ap(MyLeafSpec(20).addField(2,2).create())). addChild(ap(MyLeafSpec(10).addField(3,3).create())))))); - MatchData::UP md = MatchData::makeTestInstance(0, 100, 10); + MatchData::UP md = MatchData::makeTestInstance(100, 10); top_up->fetchPostings(false); EXPECT_EQUAL("search::queryeval::AndSearchNoStrict", top_up->createSearch(*md, false)->getClassName()); @@ -1213,7 +1213,7 @@ TEST("require that children does not optimize when parents refuse them to") { addTerm(index.getIndex().createBlueprint(requestContext, FieldSpec("f2", 2, idxth21), makeTerm("w2")), 1.0))); - MatchData::UP md = MatchData::makeTestInstance(0, 100, 10); + MatchData::UP md = MatchData::makeTestInstance(100, 10); top_up->fetchPostings(false); SearchIterator::UP search = top_up->createSearch(*md, true); EXPECT_EQUAL("search::queryeval::EquivImpl", search->getClassName()); @@ -1251,7 +1251,7 @@ TEST("require_that_unpack_optimization_is_overruled_by_equiv") { addChild(ap(MyLeafSpec(20).addField(2,idxth2).create())). addChild(ap(MyLeafSpec(10).addField(3,idxth3).create()))), 1.0))); - MatchData::UP md = MatchData::makeTestInstance(0, 100, 10); + MatchData::UP md = MatchData::makeTestInstance(100, 10); top_up->fetchPostings(false); SearchIterator::UP search = top_up->createSearch(*md, true); EXPECT_EQUAL("search::queryeval::EquivImpl", search->getClassName()); diff --git a/searchlib/src/tests/queryeval/blueprint/leaf_blueprints_test.cpp b/searchlib/src/tests/queryeval/blueprint/leaf_blueprints_test.cpp index 6efa3454d01..782e1ea5ea8 100644 --- a/searchlib/src/tests/queryeval/blueprint/leaf_blueprints_test.cpp +++ b/searchlib/src/tests/queryeval/blueprint/leaf_blueprints_test.cpp @@ -22,7 +22,7 @@ public: void Test::testEmptyBlueprint() { - MatchData::UP md(MatchData::makeTestInstance(0, 100, 10)); + MatchData::UP md(MatchData::makeTestInstance(100, 10)); EmptyBlueprint empty(FieldSpecBase(1, 11)); ASSERT_TRUE(empty.getState().numFields() == 1u); EXPECT_EQUAL(1u, empty.getState().field(0).getFieldId()); @@ -40,7 +40,7 @@ Test::testEmptyBlueprint() void Test::testSimpleBlueprint() { - MatchData::UP md(MatchData::makeTestInstance(0, 100, 10)); + MatchData::UP md(MatchData::makeTestInstance(100, 10)); SimpleResult a; a.addHit(3).addHit(5).addHit(7); SimpleBlueprint simple(a); @@ -59,7 +59,7 @@ Test::testSimpleBlueprint() void Test::testFakeBlueprint() { - MatchData::UP md(MatchData::makeTestInstance(0, 100, 10)); + MatchData::UP md(MatchData::makeTestInstance(100, 10)); FakeResult fake; fake.doc(10).len(50).pos(2).pos(3) .doc(25).len(10).pos(5); diff --git a/searchlib/src/tests/queryeval/dot_product/dot_product_test.cpp b/searchlib/src/tests/queryeval/dot_product/dot_product_test.cpp index e9dcc34219b..cc7350d35fd 100644 --- a/searchlib/src/tests/queryeval/dot_product/dot_product_test.cpp +++ b/searchlib/src/tests/queryeval/dot_product/dot_product_test.cpp @@ -61,7 +61,7 @@ struct DP { } FakeResult search(Searchable &searchable, const std::string &field, bool strict) const { - MatchData::UP md(MatchData::makeTestInstance(0, 1, 1)); + MatchData::UP md(MatchData::makeTestInstance(1, 1)); FakeRequestContext requestContext; Node::UP node = createNode(); FieldSpecList fields = FieldSpecList().add(FieldSpec(field, fieldId, handle)); @@ -107,7 +107,7 @@ struct MockFixture { std::vector children; std::vector childMatch; std::vector weights; - MatchData::UP md(MatchData::makeTestInstance(0, 1, 1)); + MatchData::UP md(MatchData::makeTestInstance(1, 1)); mock = new MockSearch(initial); children.push_back(mock); childMatch.push_back(md->resolveTermField(0)); diff --git a/searchlib/src/tests/queryeval/equiv/equiv_test.cpp b/searchlib/src/tests/queryeval/equiv/equiv_test.cpp index 3d97d05995f..d838ded85c9 100644 --- a/searchlib/src/tests/queryeval/equiv/equiv_test.cpp +++ b/searchlib/src/tests/queryeval/equiv/equiv_test.cpp @@ -50,7 +50,7 @@ Test::testEquiv() for (int i = 0; i <= 1; ++i) { bool strict = (i == 0); TEST_STATE(strict ? "strict" : "non-strict"); - MatchData::UP md = MatchData::makeTestInstance(0, 100, 10); + MatchData::UP md = MatchData::makeTestInstance(100, 10); bp->fetchPostings(strict); SearchIterator::UP search = bp->createSearch(*md, strict); search->initFullRange(); diff --git a/searchlib/src/tests/queryeval/fake_searchable/fake_searchable_test.cpp b/searchlib/src/tests/queryeval/fake_searchable/fake_searchable_test.cpp index c3ff31625d3..c4bd736e74c 100644 --- a/searchlib/src/tests/queryeval/fake_searchable/fake_searchable_test.cpp +++ b/searchlib/src/tests/queryeval/fake_searchable/fake_searchable_test.cpp @@ -76,7 +76,7 @@ Test::testTerm() for (int i = 0; i <= 1; ++i) { bool strict = (i == 0); TEST_STATE(strict ? "strict" : "non-strict"); - MatchData::UP md = MatchData::makeTestInstance(0, 100, 10); + MatchData::UP md = MatchData::makeTestInstance(100, 10); bp->fetchPostings(strict); SearchIterator::UP search = bp->createSearch(*md, strict); search->initFullRange(); @@ -130,7 +130,7 @@ Test::testPhrase() for (int i = 0; i <= 1; ++i) { bool strict = (i == 0); TEST_STATE(strict ? "strict" : "non-strict"); - MatchData::UP md = MatchData::makeTestInstance(0, 100, 10); + MatchData::UP md = MatchData::makeTestInstance(100, 10); bp->fetchPostings(strict); SearchIterator::UP search = bp->createSearch(*md, strict); search->initFullRange(); @@ -186,7 +186,7 @@ Test::testWeightedSet() for (int i = 0; i <= 1; ++i) { bool strict = (i == 0); TEST_STATE(strict ? "strict" : "non-strict"); - MatchData::UP md = MatchData::makeTestInstance(0, 100, 10); + MatchData::UP md = MatchData::makeTestInstance(100, 10); bp->fetchPostings(strict); SearchIterator::UP search = bp->createSearch(*md, strict); search->initFullRange(); @@ -262,7 +262,7 @@ Test::testMultiField() for (int i = 0; i <= 1; ++i) { bool strict = (i == 0); TEST_STATE(strict ? "strict" : "non-strict"); - MatchData::UP md = MatchData::makeTestInstance(0, 100, 10); + MatchData::UP md = MatchData::makeTestInstance(100, 10); bp->fetchPostings(strict); SearchIterator::UP search = bp->createSearch(*md, strict); search->initFullRange(); @@ -351,7 +351,7 @@ Test::testPhraseWithEmptyChild() for (int i = 0; i <= 1; ++i) { bool strict = (i == 0); TEST_STATE(strict ? "strict" : "non-strict"); - MatchData::UP md = MatchData::makeTestInstance(0, 100, 10); + MatchData::UP md = MatchData::makeTestInstance(100, 10); bp->fetchPostings(strict); SearchIterator::UP search = bp->createSearch(*md, strict); search->initFullRange(); diff --git a/searchlib/src/tests/queryeval/parallel_weak_and/parallel_weak_and_test.cpp b/searchlib/src/tests/queryeval/parallel_weak_and/parallel_weak_and_test.cpp index 74aa052e486..fd74cdeff49 100644 --- a/searchlib/src/tests/queryeval/parallel_weak_and/parallel_weak_and_test.cpp +++ b/searchlib/src/tests/queryeval/parallel_weak_and/parallel_weak_and_test.cpp @@ -169,7 +169,7 @@ struct WandBlueprintSpec SearchIterator::UP iterator(Searchable &searchable, const std::string &field) const { Node::UP term = createNode(); Blueprint::UP bp = blueprint(searchable, field, *term); - MatchData::UP md(MatchData::makeTestInstance(0, 1, 1)); + MatchData::UP md(MatchData::makeTestInstance(1, 1)); bp->fetchPostings(true); bp->setDocIdLimit(docIdLimit); SearchIterator::UP sb = bp->createSearch(*md, true); @@ -184,7 +184,7 @@ struct WandBlueprintSpec FakeResult search(Searchable &searchable, const std::string &field, const search::query::Node &term) const { Blueprint::UP bp = blueprint(searchable, field, term); - MatchData::UP md(MatchData::makeTestInstance(0, 1, 1)); + MatchData::UP md(MatchData::makeTestInstance(1, 1)); bp->fetchPostings(true); bp->setDocIdLimit(docIdLimit); SearchIterator::UP sb = bp->createSearch(*md, true); diff --git a/searchlib/src/tests/queryeval/queryeval.cpp b/searchlib/src/tests/queryeval/queryeval.cpp index fe4ad7817d6..65feb69a3e2 100644 --- a/searchlib/src/tests/queryeval/queryeval.cpp +++ b/searchlib/src/tests/queryeval/queryeval.cpp @@ -218,7 +218,7 @@ TEST("testAnd") { a.addHit(5).addHit(10).addHit(16).addHit(30); b.addHit(3).addHit(5).addHit(17).addHit(30).addHit(52); - MatchData::UP md(MatchData::makeTestInstance(0, 100, 10)); + MatchData::UP md(MatchData::makeTestInstance(100, 10)); AndBlueprint *and_b = new AndBlueprint(); and_b->addChild(Blueprint::UP(new SimpleBlueprint(a))); and_b->addChild(Blueprint::UP(new SimpleBlueprint(b))); @@ -246,7 +246,7 @@ TEST("testOr") { a.addHit(5).addHit(10); b.addHit(5).addHit(17).addHit(30); - MatchData::UP md(MatchData::makeTestInstance(0, 100, 10)); + MatchData::UP md(MatchData::makeTestInstance(100, 10)); OrBlueprint *or_b = new OrBlueprint(); or_b->addChild(Blueprint::UP(new SimpleBlueprint(a))); or_b->addChild(Blueprint::UP(new SimpleBlueprint(b))); @@ -357,7 +357,7 @@ TEST("testAndNot") { a.addHit(5).addHit(10); b.addHit(5).addHit(17).addHit(30); - MatchData::UP md(MatchData::makeTestInstance(0, 100, 10)); + MatchData::UP md(MatchData::makeTestInstance(100, 10)); AndNotBlueprint *andnot_b = new AndNotBlueprint(); andnot_b->addChild(Blueprint::UP(new SimpleBlueprint(a))); andnot_b->addChild(Blueprint::UP(new SimpleBlueprint(b))); @@ -378,7 +378,7 @@ TEST("testAndNot") { a.addHit(1).addHit(5).addHit(10); b.addHit(5).addHit(17).addHit(30); - MatchData::UP md(MatchData::makeTestInstance(2, 100, 10)); + MatchData::UP md(MatchData::makeTestInstance(100, 10)); AndNotBlueprint *andnot_b = new AndNotBlueprint(); andnot_b->addChild(Blueprint::UP(new SimpleBlueprint(a))); andnot_b->addChild(Blueprint::UP(new DummySingleValueBitNumericAttributeBlueprint(b))); @@ -402,7 +402,7 @@ TEST("testAndNot") { b.addHit(5).addHit(17).addHit(30); c.addHit(1).addHit(5).addHit(10).addHit(17).addHit(30); - MatchData::UP md(MatchData::makeTestInstance(0, 100, 10)); + MatchData::UP md(MatchData::makeTestInstance(100, 10)); AndNotBlueprint *andnot_b = new AndNotBlueprint(); andnot_b->addChild(Blueprint::UP(new SimpleBlueprint(a))); andnot_b->addChild(Blueprint::UP(new SimpleBlueprint(b))); @@ -432,7 +432,7 @@ TEST("testRank") { a.addHit(5).addHit(10).addHit(16).addHit(30); b.addHit(3).addHit(5).addHit(17).addHit(30).addHit(52); - MatchData::UP md(MatchData::makeTestInstance(0, 100, 10)); + MatchData::UP md(MatchData::makeTestInstance(100, 10)); RankBlueprint *rank_b = new RankBlueprint(); rank_b->addChild(Blueprint::UP(new SimpleBlueprint(a))); rank_b->addChild(Blueprint::UP(new SimpleBlueprint(b))); diff --git a/searchlib/src/tests/queryeval/simple_phrase/simple_phrase_test.cpp b/searchlib/src/tests/queryeval/simple_phrase/simple_phrase_test.cpp index f813d7203d0..85fce4a8215 100644 --- a/searchlib/src/tests/queryeval/simple_phrase/simple_phrase_test.cpp +++ b/searchlib/src/tests/queryeval/simple_phrase/simple_phrase_test.cpp @@ -111,7 +111,7 @@ public: _phrase_fs(field, fieldId, phrase_handle), _phrase(_phrase_fs, _requestContext), _children(), - _md(MatchData::makeTestInstance(0, 100, 10)), + _md(MatchData::makeTestInstance(100, 10)), _order(), _pos(1), _strict(false) diff --git a/searchlib/src/tests/queryeval/sourceblender/sourceblender.cpp b/searchlib/src/tests/queryeval/sourceblender/sourceblender.cpp index 2cfcf4e3f1d..1c8de3d4bf9 100644 --- a/searchlib/src/tests/queryeval/sourceblender/sourceblender.cpp +++ b/searchlib/src/tests/queryeval/sourceblender/sourceblender.cpp @@ -54,7 +54,7 @@ public: //----------------------------------------------------------------------------- TEST("test strictness") { - MatchData::UP md(MatchData::makeTestInstance(0, 100, 10)); + MatchData::UP md(MatchData::makeTestInstance(100, 10)); for (uint32_t i = 0; i < 2; ++i) { bool strict = (i == 0); diff --git a/searchlib/src/tests/queryeval/termwise_eval/termwise_eval_test.cpp b/searchlib/src/tests/queryeval/termwise_eval/termwise_eval_test.cpp index 0ef5f235ebc..95008afa574 100644 --- a/searchlib/src/tests/queryeval/termwise_eval/termwise_eval_test.cpp +++ b/searchlib/src/tests/queryeval/termwise_eval/termwise_eval_test.cpp @@ -202,10 +202,9 @@ void verify(const std::vector &expect, SearchIterator &search, uint32_ //----------------------------------------------------------------------------- MatchData::UP make_match_data() { - uint32_t num_features = 0; uint32_t num_handles = 100; uint32_t num_fields = 1; - return MatchData::makeTestInstance(num_features, num_handles, num_fields); + return MatchData::makeTestInstance(num_handles, num_fields); } //----------------------------------------------------------------------------- diff --git a/searchlib/src/vespa/searchlib/fef/featureexecutor.h b/searchlib/src/vespa/searchlib/fef/featureexecutor.h index 98f83cf13c7..1b9e219ccaa 100644 --- a/searchlib/src/vespa/searchlib/fef/featureexecutor.h +++ b/searchlib/src/vespa/searchlib/fef/featureexecutor.h @@ -9,6 +9,7 @@ #include #include #include +#include "number_or_object.h" namespace search { namespace fef { diff --git a/searchlib/src/vespa/searchlib/fef/matchdata.cpp b/searchlib/src/vespa/searchlib/fef/matchdata.cpp index 7782d50b9c8..eeff402547b 100644 --- a/searchlib/src/vespa/searchlib/fef/matchdata.cpp +++ b/searchlib/src/vespa/searchlib/fef/matchdata.cpp @@ -8,17 +8,15 @@ namespace fef { MatchData::MatchData(const Params &cparams) : _termFields(cparams.numTermFields()), - _features(cparams.numFeatures()), - _feature_is_object(cparams.numFeatures(), false), _termwise_limit(1.0) { } MatchData::UP -MatchData::makeTestInstance(uint32_t numFeatures, uint32_t numHandles, uint32_t fieldIdLimit) +MatchData::makeTestInstance(uint32_t numTermFields, uint32_t fieldIdLimit) { - MatchData::UP data(new MatchData(Params().numFeatures(numFeatures).numTermFields(numHandles))); - for (uint32_t i = 0; i < numHandles; ++i) { + MatchData::UP data(new MatchData(Params().numTermFields(numTermFields))); + for (uint32_t i = 0; i < numTermFields; ++i) { data->resolveTermField(i)->setFieldId(i % fieldIdLimit); } return data; diff --git a/searchlib/src/vespa/searchlib/fef/matchdata.h b/searchlib/src/vespa/searchlib/fef/matchdata.h index 86bbdf05262..166d6832fab 100644 --- a/searchlib/src/vespa/searchlib/fef/matchdata.h +++ b/searchlib/src/vespa/searchlib/fef/matchdata.h @@ -4,11 +4,8 @@ #include "handle.h" #include "termfieldmatchdata.h" -#include #include #include -#include -#include "number_or_object.h" namespace search { namespace fef { @@ -21,8 +18,6 @@ class MatchData { private: std::vector _termFields; - std::vector _features; - std::vector _feature_is_object; double _termwise_limit; public: @@ -33,22 +28,15 @@ public: { private: uint32_t _numTermFields; - uint32_t _numFeatures; friend class ::search::fef::MatchData; - Params() : _numTermFields(0), _numFeatures(0) {} + Params() : _numTermFields(0) {} public: uint32_t numTermFields() const { return _numTermFields; } Params & numTermFields(uint32_t value) { _numTermFields = value; return *this; } - - uint32_t numFeatures() const { return _numFeatures; } - Params & numFeatures(uint32_t value) { - _numFeatures = value; - return *this; - } }; /** * Avoid C++'s most vexing parse problem. @@ -92,14 +80,6 @@ public: **/ uint32_t getNumTermFields() const { return _termFields.size(); } - /** - * Obtain the number of features allocated in this match data - * structure. - * - * @return number of features allocated - **/ - uint32_t getNumFeatures() const { return _features.size(); } - /** * Resolve a term field handle into a pointer to the actual data. * @@ -116,42 +96,7 @@ public: **/ const TermFieldMatchData *resolveTermField(TermFieldHandle handle) const { return &_termFields[handle]; } - /** - * Resolve a feature handle into a pointer to the actual data. - * This is used to resolve both {@link FeatureExecutor#inputs} - * and {@link FeatureExecutor#outputs}. - * - * @return feature location - * @param handle feature handle - **/ - feature_t *resolveFeature(FeatureHandle handle) { return &_features[handle].as_number; } - - /** - * Resolve a feature handle into a pointer to the actual data. - * This is used to resolve both {@link FeatureExecutor#inputs} - * and {@link FeatureExecutor#outputs}. - * - * @return feature location - * @param handle feature handle - **/ - const feature_t *resolveFeature(FeatureHandle handle) const { return &_features[handle].as_number; } - - void tag_feature_as_object(FeatureHandle handle) { _feature_is_object[handle] = true; } - bool feature_is_object(FeatureHandle handle) const { return _feature_is_object[handle]; } - - vespalib::eval::Value::CREF *resolve_object_feature(FeatureHandle handle) { - assert(_feature_is_object[handle]); - return &_features[handle].as_object; - } - - const vespalib::eval::Value::CREF *resolve_object_feature(FeatureHandle handle) const { - assert(_feature_is_object[handle]); - return &_features[handle].as_object; - } - - const NumberOrObject *resolve_raw(FeatureHandle handle) const { return &_features[handle]; } - - static MatchData::UP makeTestInstance(uint32_t numFeatures, uint32_t numHandles, uint32_t fieldIdLimit); + static MatchData::UP makeTestInstance(uint32_t numTermFields, uint32_t fieldIdLimit); }; } // namespace fef diff --git a/searchlib/src/vespa/searchlib/fef/matchdatalayout.cpp b/searchlib/src/vespa/searchlib/fef/matchdatalayout.cpp index 64070006b59..c2a258a5210 100644 --- a/searchlib/src/vespa/searchlib/fef/matchdatalayout.cpp +++ b/searchlib/src/vespa/searchlib/fef/matchdatalayout.cpp @@ -8,9 +8,7 @@ namespace fef { MatchDataLayout::MatchDataLayout() : _numTermFields(0), - _numFeatures(0), - _fieldIds(), - _object_features() + _fieldIds() { } @@ -18,16 +16,11 @@ MatchData::UP MatchDataLayout::createMatchData() const { MatchData::UP md(new MatchData(MatchData::params() - .numTermFields(_numTermFields) - .numFeatures(_numFeatures))); - + .numTermFields(_numTermFields))); assert(_numTermFields == _fieldIds.size()); for (size_t i = 0; i < _numTermFields; ++i) { md->resolveTermField(i)->setFieldId(_fieldIds[i]); } - for (FeatureHandle object_handle: _object_features) { - md->tag_feature_as_object(object_handle); - } return md; } diff --git a/searchlib/src/vespa/searchlib/fef/matchdatalayout.h b/searchlib/src/vespa/searchlib/fef/matchdatalayout.h index 5b8240d3caa..227a6611030 100644 --- a/searchlib/src/vespa/searchlib/fef/matchdatalayout.h +++ b/searchlib/src/vespa/searchlib/fef/matchdatalayout.h @@ -16,9 +16,7 @@ class MatchDataLayout { private: uint32_t _numTermFields; - uint32_t _numFeatures; std::vector _fieldIds; - std::vector _object_features; public: /** @@ -37,18 +35,6 @@ public: return _numTermFields++; } - /** - * Allocate space for a feature. - * - * @return handle to be used with match data objects - **/ - FeatureHandle allocFeature(bool is_object = false) { - if (is_object) { - _object_features.push_back(_numFeatures); - } - return _numFeatures++; - } - /** * Create a match data object with the layout described by this * object. Note that this method should only be invoked after all diff --git a/searchlib/src/vespa/searchlib/fef/rank_program.cpp b/searchlib/src/vespa/searchlib/fef/rank_program.cpp index b61d1a32664..5c1c3a74a6d 100644 --- a/searchlib/src/vespa/searchlib/fef/rank_program.cpp +++ b/searchlib/src/vespa/searchlib/fef/rank_program.cpp @@ -179,7 +179,7 @@ RankProgram::setup(const MatchDataLayout &mdl_in, auto ref = specs[i].inputs[input_idx]; inputs[input_idx] = _executors[ref.executor]->outputs().get_raw(ref.output); } - size_t num_outputs = specs[i].output_types.size(); + size_t num_outputs = specs[i].output_types.size(); vespalib::ArrayRef outputs(&features[feature_offset], num_outputs); feature_offset += num_outputs; FeatureExecutor *executor = &(specs[i].blueprint->createExecutor(queryEnv, _stash)); diff --git a/streamingvisitors/src/tests/hitcollector/hitcollector.cpp b/streamingvisitors/src/tests/hitcollector/hitcollector.cpp index bed3ae8bc36..3929eb4407e 100644 --- a/streamingvisitors/src/tests/hitcollector/hitcollector.cpp +++ b/streamingvisitors/src/tests/hitcollector/hitcollector.cpp @@ -226,21 +226,19 @@ HitCollectorTest::testEmpty() class MyRankProgram : public HitCollector::IRankProgram { private: - MatchData _matchData; NumberOrObject _fooValue; NumberOrObject _barValue; public: MyRankProgram() - : _matchData(MatchData::params().numFeatures(0)), - _fooValue(), + : _fooValue(), _barValue() {} virtual void run(uint32_t docid, const std::vector &) override { _fooValue.as_number = docid + 10; _barValue.as_number = docid + 30; } - + FeatureResolver get_resolver() { FeatureResolver resolver(2); resolver.add("foo", &_fooValue, false); -- cgit v1.2.3