search: add generated query constructor
Created by: rvantonder
First of 4 PRs to clean up lucky search and remove mutations and stuff like https://sourcegraph.com/github.com/sourcegraph/sourcegraph/-/blob/internal/search/job/jobutil/feeling_lucky_search_job.go?L485
Test plan
Semantics-preserving.