private function compareSearchWeights(Content $a, Content $b)
    {
        if ($a->getSearchResultWeight() > $b->getSearchResultWeight()) {
            return -1;
        }
        if ($a->getSearchResultWeight() < $b->getSearchResultWeight()) {
            return 1;
        }
        if ($a['datepublish'] > $b['datepublish']) {
            // later is more important
            return -1;
        }
        if ($a['datepublish'] < $b['datepublish']) {
            // earlier is less important
            return 1;
        }

        return strcasecmp($a['title'], $b['title']);
    }
private function compareSearchWeights(Content $a, Content $b)
    {
        if ($a->getSearchResultWeight() > $b->getSearchResultWeight()) {
            return -1;
        }
        if ($a->getSearchResultWeight() < $b->getSearchResultWeight()) {
            return 1;
        }
        if ($a['datepublish'] > $b['datepublish']) {
            // later is more important
            return -1;
        }
        if ($a['datepublish'] < $b['datepublish']) {
            // earlier is less important
            return 1;
        }

        return strcasecmp($a['title'], $b['title']);
    }
private function compareSearchWeights ( Content $ a , Content $ b ) { if ( $ a -> getSearchResultWeight ( ) > $ b -> getSearchResultWeight ( ) ) { return - 1 ; } if ( $ a -> getSearchResultWeight ( ) < $ b -> getSearchResultWeight ( ) ) { return 1 ; } if ( $ a [ 'datepublish' ] > $ b [ 'datepublish' ] ) { // later is more important return - 1 ; } if ( $ a [ 'datepublish' ] < $ b [ 'datepublish' ] ) { // earlier is less important return 1 ; } return strcasecmp ( $ a [ 'title' ] , $ b [ 'title' ] ) ; }
Compare by search weights.

Or fallback to dates or title

@param \Bolt\Legacy\Content $a
@param \Bolt\Legacy\Content $b

@return int
Compare by search weights .