Simplify and fix (again) search/john tree query generation.