diff --git a/internal/search/run/aggregator.go b/internal/search/run/aggregator.go index 24df236fa85c2..25bbacbcc6236 100644 --- a/internal/search/run/aggregator.go +++ b/internal/search/run/aggregator.go @@ -91,23 +91,8 @@ func (a *Aggregator) DoSymbolSearch(ctx context.Context, args *search.TextParame return errors.Wrap(err, "symbol search failed") } -func (a *Aggregator) DoFilePathSearch(ctx context.Context, args *search.TextParameters) (err error) { - tr, ctx := trace.New(ctx, "doFilePathSearch", "") - tr.LogFields(trace.Stringer("global_search_mode", args.Mode)) - defer func() { - a.Error(err) - tr.SetErrorIfNotContext(err) - tr.Finish() - }() - - isDefaultStructuralSearch := args.PatternInfo.IsStructuralPat && args.PatternInfo.FileMatchLimit == search.DefaultMaxSearchResults - - if !isDefaultStructuralSearch { - return unindexed.SearchFilesInRepos(ctx, args, a) - } - +func (a *Aggregator) DoStructuralSearch(ctx context.Context, args *search.TextParameters) (err error) { // For structural search with default limits we retry if we get no results. - fileMatches, stats, err := unindexed.SearchFilesInReposBatch(ctx, args) if len(fileMatches) == 0 && err == nil { @@ -140,6 +125,23 @@ func (a *Aggregator) DoFilePathSearch(ctx context.Context, args *search.TextPara return err } +func (a *Aggregator) DoFilePathSearch(ctx context.Context, args *search.TextParameters) (err error) { + tr, ctx := trace.New(ctx, "doFilePathSearch", "") + tr.LogFields(trace.Stringer("global_search_mode", args.Mode)) + defer func() { + a.Error(err) + tr.SetErrorIfNotContext(err) + tr.Finish() + }() + + isDefaultStructuralSearch := args.PatternInfo.IsStructuralPat && args.PatternInfo.FileMatchLimit == search.DefaultMaxSearchResults + if isDefaultStructuralSearch { + return a.DoStructuralSearch(ctx, args) + } + + return unindexed.SearchFilesInRepos(ctx, args, a) +} + func (a *Aggregator) DoDiffSearch(ctx context.Context, tp *search.TextParameters) (err error) { tr, ctx := trace.New(ctx, "doDiffSearch", "") defer func() {