From befe2d842c0e499fae0b3c9f2f220c23526e340b Mon Sep 17 00:00:00 2001 From: HÃ¥vard Pettersen Date: Fri, 8 Sep 2017 12:44:13 +0000 Subject: MatchData no longer owned by RankProgram --- .../native_dot_product/native_dot_product_test.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'searchlib/src/tests/features/native_dot_product/native_dot_product_test.cpp') diff --git a/searchlib/src/tests/features/native_dot_product/native_dot_product_test.cpp b/searchlib/src/tests/features/native_dot_product/native_dot_product_test.cpp index 5ba7504f7d2..1da912ccb3a 100644 --- a/searchlib/src/tests/features/native_dot_product/native_dot_product_test.cpp +++ b/searchlib/src/tests/features/native_dot_product/native_dot_product_test.cpp @@ -72,14 +72,15 @@ std::vector vec(uint32_t w1, uint32_t w2, uint32_t w3) { struct RankFixture : BlueprintFactoryFixture, IndexFixture { QueryEnvironment queryEnv; RankSetup rankSetup; - RankProgram::UP rankProgram; MatchDataLayout mdl; + MatchData::UP match_data; + RankProgram::UP rankProgram; std::vector fooHandles; std::vector barHandles; RankFixture(const std::vector &fooWeights, const std::vector &barWeights) : queryEnv(&indexEnv), rankSetup(factory, indexEnv), - rankProgram(), mdl(), fooHandles(), barHandles() + mdl(), match_data(), rankProgram(), fooHandles(), barHandles() { for (size_t i = 0; i < fooWeights.size(); ++i) { uint32_t fieldId = indexEnv.getFieldByName("foo")->id(); @@ -100,8 +101,9 @@ struct RankFixture : BlueprintFactoryFixture, IndexFixture { rankSetup.setFirstPhaseRank(featureName); rankSetup.setIgnoreDefaultRankFeatures(true); ASSERT_TRUE(rankSetup.compile()); + match_data = mdl.createMatchData(); rankProgram = rankSetup.create_first_phase_program(); - rankProgram->setup(mdl, queryEnv); + rankProgram->setup(*match_data, queryEnv); } feature_t getScore(uint32_t docId) { return Utils::getScoreFeature(*rankProgram, docId); @@ -110,15 +112,15 @@ struct RankFixture : BlueprintFactoryFixture, IndexFixture { ASSERT_LESS(i, fooHandles.size()); TermFieldMatchDataPosition pos; pos.setElementWeight(index_weight); - rankProgram->match_data().resolveTermField(fooHandles[i])->reset(docId); - rankProgram->match_data().resolveTermField(fooHandles[i])->appendPosition(pos); + match_data->resolveTermField(fooHandles[i])->reset(docId); + match_data->resolveTermField(fooHandles[i])->appendPosition(pos); } void setBarWeight(uint32_t i, uint32_t docId, int32_t index_weight) { ASSERT_LESS(i, barHandles.size()); TermFieldMatchDataPosition pos; pos.setElementWeight(index_weight); - rankProgram->match_data().resolveTermField(barHandles[i])->reset(docId); - rankProgram->match_data().resolveTermField(barHandles[i])->appendPosition(pos); + match_data->resolveTermField(barHandles[i])->reset(docId); + match_data->resolveTermField(barHandles[i])->appendPosition(pos); } }; -- cgit v1.2.3