Ejemplo n.º 1
0
  public static List<SolrQuery.SortClause> getSortClauses(String sortInfo) {
    List<SolrQuery.SortClause> sortClauses = new ArrayList<SolrQuery.SortClause>();

    if (sortInfo == null) {
      sortClauses.add(SORT_CLAUSE);
    } else {
      for (String sortClauseData : sortInfo.split(SORT_FIELD_REQ_DELIM)) {
        if (nullOrEmpty(sortClauseData)) continue;

        Matcher m = SORT_PATTERN.matcher(sortClauseData);
        if (m.matches()) {
          sortClauses.add(new SolrQuery.SortClause(m.group(1), getSortOrder(m.group(2))));
        }
      }
    }
    return sortClauses;
  }
Ejemplo n.º 2
0
  public static List<String> getValidFieldNamesSubset(Collection<String> fieldNames) {
    List<String> fieldNamesSubset = new ArrayList<String>();

    for (String fieldName : fieldNames) {
      if (!ignoreFieldName(fieldName, Arrays.asList(ID))) {
        fieldNamesSubset.add(fieldName);
      }
    }
    Collections.sort(fieldNamesSubset);
    return fieldNamesSubset;
  }
Ejemplo n.º 3
0
 public static List<SolrQuery.SortClause> getSortClauses(String sortInfo, String sortOrder) {
   if (sortInfo == null) {
     return null;
   }
   if (sortOrder == null || sortInfo.contains(SORT_FIELD_REQ_DELIM)) {
     return getSortClauses(sortInfo);
   }
   List<SolrQuery.SortClause> sortClauses = new ArrayList<SolrQuery.SortClause>();
   sortClauses.add(new SolrQuery.SortClause(sortInfo, sortOrder));
   return sortClauses;
 }