Skip to content

Commit

Permalink
opt: respect maxResult parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoyifang committed Jun 24, 2024
1 parent 2b9d172 commit 946a38c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/btreeidx.cc
Original file line number Diff line number Diff line change
Expand Up @@ -290,15 +290,15 @@ void BtreeWordSearchRequest::findMatches()
|| (int)resultFolded.size() - initialFoldedSize <= maxSuffixVariation ) )
addMatch( Utf8::decode( x.prefix + x.word ) );
}
if ( matches.size() >= maxResults ) {
break;
}
}

if ( Utils::AtomicInt::loadAcquire( isCancelled ) )
break;

if ( matches.size() >= maxResults ) {
// For now we actually allow more than maxResults if the last
// chain yield more than one result. That's ok and maybe even more
// desirable.
break;
}
}
Expand Down

0 comments on commit 946a38c

Please sign in to comment.