mirror of
https://github.com/sourcegraph/sourcegraph.git
synced 2026-02-06 16:31:47 +00:00
Searcher: fix optimization for empty patterns (#60646)
In #59331, we refactored the searcher logic to support AND/ OR patterns in searcher. While doing so, we accidentally regressed on an optimization that avoids loading file content when the pattern is empty. We now have a benchmark for empty patterns, but this benchmark was added recently and wasn't run during that refactor.
This commit is contained in:
parent
cd8624b604
commit
4c873f8d0c
@ -147,7 +147,7 @@ func regexSearch(
|
||||
}
|
||||
|
||||
if !match && patternMatchesContent {
|
||||
if _, ok := m.(allMatchTree); ok {
|
||||
if _, ok := m.(*allMatchTree); ok {
|
||||
// Avoid loading the file if this pattern always matches
|
||||
match = true
|
||||
} else {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user