protected function makeIndexQuery()
    {
        // Open up the query. We can assume that Model has an ordered() function
        // because it's defined on Decoy's Base_Model
        $query = $this->parent ?
            $this->parentRelation()->ordered() :
            call_user_func([$this->model, 'ordered']);

        // Allow trashed records
        if ($this->withTrashed()) {
            $query->withTrashed();
        }

        // Apply search
        $search = new Search();
        $query = $search->apply($query, $this->search());
        return $query;
    }