search: separate static vs runtime construction in lucky search
Created by: rvantonder
Stacked on https://github.com/sourcegraph/sourcegraph/pull/38356
This just factors the closures created so it doesn't bloat functions as much and explains the reasoning. Again, at a later stage I might revisit to see how to remove the need for this.
Test plan
Updated tests