Skip to content

Commit

Permalink
Merge pull request #32976 from vespa-engine/toregge/extend-semantic-l…
Browse files Browse the repository at this point in the history
…ifetime-of-weights-vector

Extend semantic lifetime of weights vector.
  • Loading branch information
geirst authored Nov 30, 2024
2 parents ca78e65 + 55aa254 commit 28f529f
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -225,10 +225,12 @@ struct RiseWandFactory : SparseVectorFactory {

struct WeightedSetFactory : SparseVectorFactory {
mutable TermFieldMatchData tfmd;
mutable std::vector<int32_t> weights;
bool field_is_filter;

WeightedSetFactory(bool field_is_filter_, bool term_is_not_needed)
: tfmd(),
weights(),
field_is_filter(field_is_filter_)
{
if (term_is_not_needed) {
Expand All @@ -240,7 +242,7 @@ struct WeightedSetFactory : SparseVectorFactory {
}
SearchIterator::UP createSparseVector(ChildFactory &childFactory, uint32_t childCnt, uint32_t limit) const override {
std::vector<SearchIterator *> terms;
std::vector<int32_t> weights;
weights.clear();
for (size_t i = 0; i < childCnt; ++i) {
// TODO: pass ownership with unique_ptr
terms.push_back(childFactory.createChild(i, limit).release());
Expand Down

0 comments on commit 28f529f

Please sign in to comment.