fix query prepend logic for json searches