protected SortField [ ] createSortFields ( QPath [ ] orderProps , boolean [ ] orderSpecs , FieldComparatorSource scs ) throws RepositoryException { List < SortField > sortFields = new ArrayList < SortField > ( ) ; for ( int i = 0 ; i < orderProps . length ; i ++ ) { if ( orderProps [ i ] . getEntries ( ) . length == 1 && Constants . JCR_SCORE . equals ( orderProps [ i ] . getName ( ) ) ) { // order on jcr:score does not use the natural order as // implemented in lucene. score ascending in lucene means that // higher scores are first. JCR specs that lower score values // are first. sortFields . add ( new SortField ( null , SortField . SCORE , orderSpecs [ i ] ) ) ; } else { String jcrPath = npResolver . createJCRPath ( orderProps [ i ] ) . getAsString ( false ) ; sortFields . add ( new SortField ( jcrPath , scs , ! orderSpecs [ i ] ) ) ; } } return sortFields . toArray ( new SortField [ sortFields . size ( ) ] ) ; }
Creates the SortFields for the order properties .