Refactoring for SearchTrait.