Global.helma.Search.Searcher.prototype.sortBy (fieldName)
Sets a field as result sorting field. This method can be called with a different number of arguments: sortBy(fieldName) sortBy(fieldName, type) sortBy(fieldName, reverse) sortBy(fieldName, type, reverse)

  • Parameter {String}:
    fieldName The name of the field in the index by which the search result should be ordered.
  • Parameter {String}:
    type The type of the field defined by argument fieldName. Valid arguments are "string", "float", "int", "score", "doc", "auto", "custom". Default is "auto". See http://lucene.apache.org/java/docs/api/org/apache/lucene/search/SortField.html for an explanation.
Sourcecode in /home/hannes/helma/modules/helma/Search.js:
680:   helma.Search.Searcher.prototype.sortBy = function(fieldName /** type, reverse */) {
681:       var PKG = Packages.org.apache.lucene.search;
682:       if (!this.sortFields)
683:           this.sortFields = new java.util.Vector();
684:       var f = fieldName;
685:       var t = PKG.SortField.AUTO;
686:       var r = false;
687:       if (arguments.length == 3) {
688:           t = PKG.SortField[arguments[1].toUpperCase()];
689:          r = arguments[2];
690:      } else if (arguments.length == 2) {
691:          if (arguments[1].constructor == Boolean) {
692:              r = arguments[1];
693:          } else {
694:              t = PKG.SortField[arguments[1].toUpperCase()];
695:          }
696:      }
697:      this.sortFields.add(new PKG.SortField(f, t, r));
698:      return;
699:  }