Package com.dotcms.repackage.org.elasticsearch.action.search

Examples of com.dotcms.repackage.org.elasticsearch.action.search.SearchRequestBuilder.addSort()


            if(offset>0)
                srb.setFrom(offset);

            if(UtilMethods.isSet(sortBy)) {
              if(sortBy.equals("random")) {
                srb.addSort(SortBuilders.scriptSort("Math.random()", "number"));
              }
              else if(sortBy.endsWith("-order")) {
                  // related content ordering
                  int ind0=sortBy.indexOf('-'); // relationships tipicaly have a format stname1-stname2
                  int ind1=ind0>0 ? sortBy.indexOf('-',ind0+1) : -1;
View Full Code Here


                  if(ind1>0) {
                      String relName=sortBy.substring(0, ind1);
                      if((ind1+1)<sortBy.length()) {
                          String identifier=sortBy.substring(ind1+1, sortBy.length()-6);
                          if(UtilMethods.isSet(identifier)) {
                              srb.addSort(SortBuilders.scriptSort("related", "number")
                                                      .lang("native")
                                                      .param("relName", relName)
                                                      .param("identifier", identifier)
                                                      .order(SortOrder.ASC));
                          }
View Full Code Here

                  String[] x=sort.trim().split(" ");
  //                srb.addSort(SortBuilders.fieldSort(x[0].toLowerCase()).order(x.length>1 && x[1].equalsIgnoreCase("desc") ?
  //                            SortOrder.DESC : SortOrder.ASC));
  //                srb.addSort(SortBuilders.fieldSort(x[0].toLowerCase() + ".org").order(x.length>1 && x[1].equalsIgnoreCase("desc") ?
  //                          SortOrder.DESC : SortOrder.ASC));
                  srb.addSort(SortBuilders.fieldSort(x[0].toLowerCase() + "_dotraw").order(x.length>1 && x[1].equalsIgnoreCase("desc") ?
                                  SortOrder.DESC : SortOrder.ASC));
  //                srb.addSort(x[0].toLowerCase(),x.length>1 && x[1].equalsIgnoreCase("desc") ?
  //                            SortOrder.DESC : SortOrder.ASC);

          }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.