Skip to content

search: factor out Zoekt params for both global/non-global paths

Administrator requested to merge backend-dry-run/rvt/zoekt-job-3 into main

Created by: rvantonder

Semantics preserving. Stacked on https://github.com/sourcegraph/sourcegraph/pull/25418.

  • Factors out the common parts where we convert PatternInfo into a ZoektQuery along two paths: non-global and global searches. We can do this once now.
q, err := search.QueryToZoektQuery(...)
  • Factors out the common state for both these paths:
	zoektArgs := &search.ZoektParameters{
		Query:          q,
		Typ:            typ,
		FileMatchLimit: args.PatternInfo.FileMatchLimit,
		Select:         args.PatternInfo.Select,
		Zoekt:          args.Zoekt,
	}

Both of the above items are app state that we know statically up front from queries, and will trickle up for optimized Zoekt query construction/validation. (Strictly speaking args.Zoekt client is not static, but a runtime value. But, we know it's state early and, the static parts here don't depend on this runtime value, so we can basically treat it as static since it exists at the earliest point of our app. Note that an example of a true runtime value that we cannot depend on in Zoekt query construction/validation, is the set of resolved repos).

  • Factors out the common state for both these paths:
	zoektArgs := &search.ZoektParameters{
		Query:          q,
		Typ:            typ,
		FileMatchLimit: args.PatternInfo.FileMatchLimit,
		Select:         args.PatternInfo.Select,
		Zoekt:          args.Zoekt,
	}

Both of the above items are app state that we know statically up front from queries, and will trickle up for optimized Zoekt query construction/validation. (Strictly speaking args.Zoekt client is not static, but a runtime value. But, we know it's state early and, the static parts here don't depend on this runtime value, so we can basically treat it as static since it exists at the earliest point of our app. Note that an example of a true runtime value that we cannot depend on in Zoekt query construction/validation, is the set of resolved repos).

Merge request reports

Loading