search: simplify query generator control flow
Created by: rvantonder
Simplifies the base case value for the query generator, so the surrounding control flow simplifies to
g := NewGenerator(...)
for g != nil {
autoQ, g = g()
// stuff
}
(Rework of https://github.com/sourcegraph/sourcegraph/pull/38698)
Test plan
Semantics-preserving, covered by tests.