impr(search): perform requests only if valid queries change

refactor(search): move side-effect-free functions out of scope

related to CAM-2756