lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dna...@apache.org
Subject cvs commit: jakarta-lucene/src/java/org/apache/lucene/search Sort.java
Date Sun, 05 Sep 2004 22:49:26 GMT
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 <code>field</code> then by index order (document
  -	 * number). The type of value in <code>field</code> is determined
  -	 * automatically.
  -	 * @see SortField#AUTO
  -	 */
  -	public Sort (String field) {
  -		setSort (field, false);
  -	}
  -
  -
  -	/** Sorts possibly in reverse by the terms in <code>field</code> then by
  -	 * index order (document number). The type of value in <code>field</code>
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 <code>field</code> 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 <code>field</code> then by index order
  -	 * (document number). */
  -	public final void setSort (String field) {
  -		setSort (field, false);
  -	}
  -
  -
  -	/** Sets the sort to the terms in <code>field</code> 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 <code>field</code> then by index order (document
  +   * number). The type of value in <code>field</code> is determined
  +   * automatically.
  +   * 
  +   * @see SortField#AUTO
  +   */
  +  public Sort(String field) {
  +    setSort(field, false);
  +  }
  +
  +  /**
  +   * Sorts possibly in reverse by the terms in <code>field</code> then by
  +   * index order (document number). The type of value in <code>field</code>
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
  +   * <code>field</code> 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 <code>field</code> then by index order
  +   * (document number).
  +   */
  +  public final void setSort(String field) {
  +    setSort(field, false);
  +  }
  +
  +  /**
  +   * Sets the sort to the terms in <code>field</code> 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


Mime
View raw message