Implementation of search operation.