protected boolean isSortScoring(IndexSearcher searcher, Sort sort) {

        boolean doScoring = false;
        if (sort != null) {
            if ((sort == CmsSearchParameters.SORT_DEFAULT) || (sort == CmsSearchParameters.SORT_TITLE)) {
                // these default sorts do need score calculation
                doScoring = true;
            } else if ((sort == CmsSearchParameters.SORT_DATE_CREATED)
                || (sort == CmsSearchParameters.SORT_DATE_LASTMODIFIED)) {
                // these default sorts don't need score calculation
                doScoring = false;
            } else {
                // for all non-defaults: check if the score field is present, in that case we must calculate the score
                SortField[] fields = sort.getSort();
                for (SortField field : fields) {
                    if (field == SortField.FIELD_SCORE) {
                        doScoring = true;
                        break;
                    }
                }
            }
        }
        return doScoring;
    }
protected boolean isSortScoring ( IndexSearcher searcher , Sort sort ) { boolean doScoring = false ; if ( sort != null ) { if ( ( sort == CmsSearchParameters . SORT_DEFAULT ) || ( sort == CmsSearchParameters . SORT_TITLE ) ) { doScoring = true ; } else if ( ( sort == CmsSearchParameters . SORT_DATE_CREATED ) || ( sort == CmsSearchParameters . SORT_DATE_LASTMODIFIED ) ) { doScoring = false ; } else { SortField [ ] fields = sort . getSort ( ) ; for ( SortField field : fields ) { if ( field == SortField . FIELD_SCORE ) { doScoring = true ; break ; } } } } return doScoring ; }
Checks if the score for the results must be calculated based on the provided sort option.<p>

Since Lucene 3 apparently the score is no longer calculated by default, but only if the
searcher is explicitly told so. This methods checks if, based on the given sort,
the score must be calculated.<p>

@param searcher the index searcher to prepare
@param sort the sort option to use

@return true if the sort option should be used