code: 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()]);
     }
docs: Creates the SortFields for the order properties.
  
  @param orderProps
  the order properties.
  @param orderSpecs
  the order specs for the properties.
  @param scs
  {@link FieldComparatorSource} case sensitive or case insensitive comparator
  @return an array of sort fields
  @throws RepositoryException