Skip to content

Commit

Permalink
Merge pull request #33015 from vespa-engine/toregge/dot-product-and-w…
Browse files Browse the repository at this point in the history
…eighted-set-operators-dont-need-ranking

Weighted set and dot product operators don't need ranking.
  • Loading branch information
geirst authored Dec 9, 2024
2 parents ff2bf65 + 9f7672a commit 7db3d8d
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 18 deletions.
16 changes: 0 additions & 16 deletions searchcore/src/tests/proton/matching/query_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1175,22 +1175,6 @@ TEST(QueryTest, weak_and_term_needs_ranking)
EXPECT_TRUE(query_needs_ranking(StackDumpCreator::create(*builder.build())));
}

TEST(QueryTest, weighted_set_term_needs_ranking)
{
QueryBuilder<ProtonNodeTypes> builder;
auto& ws = builder.addWeightedSetTerm(1, "f1", 1, Weight(1));
ws.addTerm("xyz", Weight(1));
EXPECT_TRUE(query_needs_ranking(StackDumpCreator::create(*builder.build())));
}

TEST(QueryTest, dot_product_term_needs_ranking)
{
QueryBuilder<ProtonNodeTypes> builder;
auto& dp = builder.addDotProduct(1, "f1", 1, Weight(1));
dp.addTerm("xyz", Weight(1));
EXPECT_TRUE(query_needs_ranking(StackDumpCreator::create(*builder.build())));
}

TEST(QueryTest, wand_term_needs_ranking)
{
QueryBuilder<ProtonNodeTypes> builder;
Expand Down
2 changes: 0 additions & 2 deletions searchcore/src/vespa/searchcore/proton/matching/query.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,6 @@ class NeedsRankingVisitor : public TemplateTermVisitor<NeedsRankingVisitor, Prot
}
template <class TermNode> void visitTerm(TermNode&) { }
void visit(ProtonNodeTypes::WeakAnd&) override { _needs_ranking = true; }
void visitTerm(ProtonNodeTypes::WeightedSetTerm&) { _needs_ranking = true; }
void visitTerm(ProtonNodeTypes::DotProduct&) { _needs_ranking = true; }
void visitTerm(ProtonNodeTypes::WandTerm&) { _needs_ranking = true; }
bool needs_ranking() const noexcept { return _needs_ranking; }
};
Expand Down

0 comments on commit 7db3d8d

Please sign in to comment.