Return-Path: Delivered-To: apmail-jakarta-lucene-dev-archive@www.apache.org Received: (qmail 45375 invoked from network); 5 Sep 2004 22:49:31 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 5 Sep 2004 22:49:31 -0000 Received: (qmail 17196 invoked by uid 500); 5 Sep 2004 22:49:28 -0000 Delivered-To: apmail-jakarta-lucene-dev-archive@jakarta.apache.org Received: (qmail 17186 invoked by uid 500); 5 Sep 2004 22:49:28 -0000 Mailing-List: contact lucene-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Lucene Developers List" Reply-To: "Lucene Developers List" Delivered-To: mailing list lucene-dev@jakarta.apache.org Received: (qmail 17173 invoked by uid 500); 5 Sep 2004 22:49:28 -0000 Received: (qmail 17168 invoked by uid 99); 5 Sep 2004 22:49:28 -0000 X-ASF-Spam-Status: No, hits=-2.8 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.28) with SMTP; Sun, 05 Sep 2004 15:49:27 -0700 Received: (qmail 45354 invoked by uid 1912); 5 Sep 2004 22:49:26 -0000 Date: 5 Sep 2004 22:49:26 -0000 Message-ID: <20040905224926.45353.qmail@minotaur.apache.org> From: dnaber@apache.org To: jakarta-lucene-cvs@apache.org Subject: cvs commit: jakarta-lucene/src/java/org/apache/lucene/search Sort.java X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N dnaber 2004/09/05 15:49:26 Modified: src/java/org/apache/lucene/search Sort.java Log: don't mix spaces and tabs (but use spaces only), no functional change Revision Changes Path 1.8 +104 -103 jakarta-lucene/src/java/org/apache/lucene/search/Sort.java Index: Sort.java =================================================================== RCS file: /home/cvs/jakarta-lucene/src/java/org/apache/lucene/search/Sort.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- Sort.java 5 Apr 2004 17:23:38 -0000 1.7 +++ Sort.java 5 Sep 2004 22:49:26 -0000 1.8 @@ -100,114 +100,115 @@ public class Sort implements Serializable { - /** Represents sorting by computed relevance. Using this sort criteria - * returns the same results as calling {@link Searcher#search(Query) Searcher#search()} - * without a sort criteria, only with slightly more overhead. */ - public static final Sort RELEVANCE = new Sort(); - - /** Represents sorting by index order. */ - public static final Sort INDEXORDER = new Sort (SortField.FIELD_DOC); - - // internal representation of the sort criteria - SortField[] fields; - - - /** Sorts by computed relevance. This is the same sort criteria as - * calling {@link Searcher#search(Query) Searcher#search()} without a sort criteria, only with - * slightly more overhead. */ - public Sort() { - this (new SortField[]{SortField.FIELD_SCORE, SortField.FIELD_DOC}); - } - - - /** Sorts by the terms in field then by index order (document - * number). The type of value in field is determined - * automatically. - * @see SortField#AUTO - */ - public Sort (String field) { - setSort (field, false); - } - - - /** Sorts possibly in reverse by the terms in field then by - * index order (document number). The type of value in field is determined - * automatically. - * @see SortField#AUTO - */ - public Sort (String field, boolean reverse) { - setSort (field, reverse); - } - - - /** Sorts in succession by the terms in each field. - * The type of value in field is determined - * automatically. - * @see SortField#AUTO - */ - public Sort (String[] fields) { - setSort (fields); - } - - - /** Sorts by the criteria in the given SortField. */ - public Sort (SortField field) { - setSort (field); - } - - - /** Sorts in succession by the criteria in each SortField. */ - public Sort (SortField[] fields) { - setSort (fields); - } - - - /** Sets the sort to the terms in field then by index order - * (document number). */ - public final void setSort (String field) { - setSort (field, false); - } - - - /** Sets the sort to the terms in field possibly in reverse, - * then by index order (document number). */ - public void setSort (String field, boolean reverse) { - SortField[] nfields = new SortField[]{ - new SortField (field, SortField.AUTO, reverse), - SortField.FIELD_DOC - }; - fields = nfields; - } - - - /** Sets the sort to the terms in each field in succession. */ - public void setSort (String[] fieldnames) { - final int n = fieldnames.length; - SortField[] nfields = new SortField[n]; - for (int i = 0; i < n; ++i) { - nfields[i] = new SortField (fieldnames[i], SortField.AUTO); - } - fields = nfields; - } - - - /** Sets the sort to the given criteria. */ - public void setSort (SortField field) { - this.fields = new SortField[]{field}; - } - - - /** Sets the sort to the given criteria in succession. */ - public void setSort (SortField[] fields) { - this.fields = fields; - } + /** + * Represents sorting by computed relevance. Using this sort criteria returns + * the same results as calling + * {@link Searcher#search(Query) Searcher#search()}without a sort criteria, + * only with slightly more overhead. + */ + public static final Sort RELEVANCE = new Sort(); + + /** Represents sorting by index order. */ + public static final Sort INDEXORDER = new Sort(SortField.FIELD_DOC); + + // internal representation of the sort criteria + SortField[] fields; + + /** + * Sorts by computed relevance. This is the same sort criteria as calling + * {@link Searcher#search(Query) Searcher#search()}without a sort criteria, + * only with slightly more overhead. + */ + public Sort() { + this(new SortField[] { SortField.FIELD_SCORE, SortField.FIELD_DOC }); + } + + /** + * Sorts by the terms in field then by index order (document + * number). The type of value in field is determined + * automatically. + * + * @see SortField#AUTO + */ + public Sort(String field) { + setSort(field, false); + } + + /** + * Sorts possibly in reverse by the terms in field then by + * index order (document number). The type of value in field is + * determined automatically. + * + * @see SortField#AUTO + */ + public Sort(String field, boolean reverse) { + setSort(field, reverse); + } + + /** + * Sorts in succession by the terms in each field. The type of value in + * field is determined automatically. + * + * @see SortField#AUTO + */ + public Sort(String[] fields) { + setSort(fields); + } + + /** Sorts by the criteria in the given SortField. */ + public Sort(SortField field) { + setSort(field); + } + + /** Sorts in succession by the criteria in each SortField. */ + public Sort(SortField[] fields) { + setSort(fields); + } + + /** + * Sets the sort to the terms in field then by index order + * (document number). + */ + public final void setSort(String field) { + setSort(field, false); + } + + /** + * Sets the sort to the terms in field possibly in reverse, + * then by index order (document number). + */ + public void setSort(String field, boolean reverse) { + SortField[] nfields = new SortField[] { + new SortField(field, SortField.AUTO, reverse), SortField.FIELD_DOC }; + fields = nfields; + } + + /** Sets the sort to the terms in each field in succession. */ + public void setSort(String[] fieldnames) { + final int n = fieldnames.length; + SortField[] nfields = new SortField[n]; + for (int i = 0; i < n; ++i) { + nfields[i] = new SortField(fieldnames[i], SortField.AUTO); + } + fields = nfields; + } + + /** Sets the sort to the given criteria. */ + public void setSort(SortField field) { + this.fields = new SortField[] { field }; + } + + /** Sets the sort to the given criteria in succession. */ + public void setSort(SortField[] fields) { + this.fields = fields; + } public String toString() { StringBuffer buffer = new StringBuffer(); for (int i = 0; i < fields.length; i++) { buffer.append(fields[i].toString()); - if ((i +1) < fields.length) + if ((i+1) < fields.length) buffer.append(','); } --------------------------------------------------------------------- To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: lucene-dev-help@jakarta.apache.org