Skip to content

Commit

Permalink
Avoid streaming through the haystack an extra time in case-insensitiv…
Browse files Browse the repository at this point in the history
…e search

Signed-off-by: Alex Saveau <[email protected]>
  • Loading branch information
SUPERCILEX committed Jul 26, 2024
1 parent ec1f353 commit 4503f29
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions client-sdk/src/search.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ struct PlainIgnoreCaseQuery {
impl QueryImpl for PlainIgnoreCaseQuery {
fn find(&mut self, haystack: &[u8]) -> Option<(usize, usize)> {
self.cache.clear();
self.cache.extend_from_slice(haystack);
self.cache.make_ascii_lowercase();
self.cache
.extend(haystack.iter().map(u8::to_ascii_lowercase));

self.inner.find(&self.cache)
}
Expand Down

0 comments on commit 4503f29

Please sign in to comment.