refactoring search view and limit logic