Implements searchSegmentByTask