Skip to content
This repository has been archived by the owner on May 3, 2024. It is now read-only.

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
MBkkt committed Jan 25, 2024
1 parent dbc788e commit 8397ffe
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
7 changes: 4 additions & 3 deletions core/search/phrase_filter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ struct PrepareVisitor : util::noncopyable {
}

auto operator()(const by_terms_options& part) const {
return by_terms::Prepare(ctx, field, part);
return filter::prepared::ptr{};
}

auto operator()(const by_range_options& part) const {
Expand Down Expand Up @@ -444,8 +444,9 @@ filter::prepared::ptr by_phrase::Prepare(const PrepareContext& ctx,
if (1 == options.size()) {
auto query =
std::visit(PrepareVisitor{ctx, field}, options.begin()->second);
IRS_ASSERT(query);
return query;
if (query) {
return query;
}
}

// prepare phrase stats (collector for each term)
Expand Down
3 changes: 2 additions & 1 deletion core/search/terms_filter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ filter::prepared::ptr by_terms::Prepare(const PrepareContext& ctx,

filter::prepared::ptr by_terms::prepare(const PrepareContext& ctx) const {
if (options().terms.empty() || options().min_match != 0) {
return Prepare(ctx, field(), options());
return Prepare(ctx.Boost(boost()), field(), options());
}
if (ctx.scorers.empty()) {
return MakeAllDocsFilter(kNoBoost)->prepare({
Expand All @@ -168,6 +168,7 @@ filter::prepared::ptr by_terms::prepare(const PrepareContext& ctx) const {
disj.add(MakeAllDocsFilter(0.F));
// Reset min_match to 1
auto& terms = disj.add<by_terms>();
terms.boost(boost());
*terms.mutable_field() = field();
*terms.mutable_options() = options();
terms.mutable_options()->min_match = 1;
Expand Down

0 comments on commit 8397ffe

Please sign in to comment.