Skip to content

Search backend: optimize jobs by construction

Created by: camdencheek

In order to create queries that are optimized for Zoekt, we currently run an optimization pass over the generated job tree, regenerating jobs that can use a query.Basic directly and replacing them with a NoopJob.

This modifies that flow to instead generate jobs before splitting a query.Basic into query.Flat. The basic idea is that now NewBasicJob generates jobs directly if those jobs can use the structure of a basic query. Otherwise, we split the basic query into flat queries (formalized as query.Flat in the followup PR) and create jobs from flat queries then add them to the basic job.

I'd recommend scanning through the commits in order since they're atomic changes that have self-describing messages.

Test plan

Each commit passes tests individually, and I've tested manually. Additionally, in a followup PR, I did a bunch of renames and extensions of existing tests that all pass. I triggered backend integration tests.

Merge request reports

Loading