Skip to content

Commit

Permalink
Do more lookups, but try to avoid the largests bounds this way
Browse files Browse the repository at this point in the history
  • Loading branch information
tibvdm committed Aug 26, 2024
1 parent 6d8c54e commit f7c66a2
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions sa-index/src/sa_searcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -308,9 +308,12 @@ impl Searcher {
// Use the (up to) first 5 characters of the search string as the kmer
// If the kmer is found in the cache, use the bounds from the cache as start bounds
// to find the bounds of the entire string
let max_mer = &search_string[..min(5, search_string.len())];
if let Some(bounds) = self.kmer_cache.get_kmer(max_mer) {
return self.search_bounds_no_cache(search_string, bounds);
let mut max_mer_length = min(5, search_string.len());
while max_mer_length > 0 {
if let Some(bounds) = self.kmer_cache.get_kmer(&search_string[..max_mer_length]) {
return self.search_bounds_no_cache(search_string, bounds);
}
max_mer_length -= 1;
}

BoundSearchResult::NoMatches
Expand Down

0 comments on commit f7c66a2

Please sign in to comment.