refactored search result highlighting