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

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
MBkkt committed Dec 1, 2023
1 parent 1bb161a commit ae7ea00
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions core/search/ngram_similarity_query.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -581,12 +581,17 @@ doc_iterator::ptr NGramSimilarityQuery::execute(
if (itrs.size() < min_match_count_) {
return doc_iterator::empty();
}
if (itrs.size() == 1) {
return std::move(itrs[0].it);
}
if (itrs.size() == min_match_count_) {
return memory::make_managed<NGramSimilarityDocIterator<
NGramApprox<true>, SerialPositionsChecker<Dummy>>>(
std::move(itrs), segment, *query_state->field, boost(), stats_.c_str(),
query_state->terms.size(), min_match_count_, ord);
}
// TODO(MBkkt) min_match_count_ == 1: disjunction for approx,
// optimization for low threshold case
return memory::make_managed<NGramSimilarityDocIterator<
NGramApprox<false>, SerialPositionsChecker<Dummy>>>(
std::move(itrs), segment, *query_state->field, boost(), stats_.c_str(),
Expand All @@ -607,11 +612,16 @@ doc_iterator::ptr NGramSimilarityQuery::ExecuteWithOffsets(
if (itrs.size() < min_match_count_) {
return doc_iterator::empty();
}
if (itrs.size() == 1) {
return std::move(itrs[0].it);
}
if (itrs.size() == min_match_count_) {
return memory::make_managed<NGramSimilarityDocIterator<
NGramApprox<true>, SerialPositionsChecker<NGramPosition>>>(
std::move(itrs), query_state->terms.size(), min_match_count_, true);
}
// TODO(MBkkt) min_match_count_ == 1: disjunction for approx,
// optimization for low threshold case
return memory::make_managed<NGramSimilarityDocIterator<
NGramApprox<false>, SerialPositionsChecker<NGramPosition>>>(
std::move(itrs), query_state->terms.size(), min_match_count_, true);
Expand Down

0 comments on commit ae7ea00

Please sign in to comment.