Updated database search service to support sorting