com.sun.labs.minion.retrieval
Class SortSpec

java.lang.Object
  extended by com.sun.labs.minion.retrieval.SortSpec

public class SortSpec
extends java.lang.Object

A class to contain a sorting specification for a results set. Results can be sorted by any combination of saved fields and the score assigned to the document.


Field Summary
protected  boolean[] directions
          The directions in which to sort each of the fields.
protected  BasicField.Fetcher[] fetchers
          Fetchers for any saved fields in the sorting spec.
protected  FieldInfo[] fields
          The fields upon which to sort.
protected static java.lang.String logTag
           
protected  int size
          The size of the specification, in terms of the number of fields.
protected  java.lang.String spec
          The original specification.
 
Constructor Summary
SortSpec(PartitionManager manager, java.lang.String spec)
          Creates a sorting specification from the given string description.
SortSpec(SortSpec ss, InvFileDiskPartition part)
          Constructs a partition specific sorting specification that includes fetchers for the saved fields appearing in the sorting specification.
 
Method Summary
 boolean getDirection(int i)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

spec

protected java.lang.String spec
The original specification.


size

protected int size
The size of the specification, in terms of the number of fields.


fields

protected FieldInfo[] fields
The fields upon which to sort.


fetchers

protected BasicField.Fetcher[] fetchers
Fetchers for any saved fields in the sorting spec.


directions

protected boolean[] directions
The directions in which to sort each of the fields. true indicates that the sort is in an increasing direction, while false indicates that the sort is in a decreasing direction.


logTag

protected static java.lang.String logTag
Constructor Detail

SortSpec

public SortSpec(PartitionManager manager,
                java.lang.String spec)
Creates a sorting specification from the given string description.

Parameters:
spec - The sorting specification. This is of the form: [+|-]fieldName{,[+|-]fieldName}{,[+|-]fieldName}...

A + indicates that the values from the named field should be sorted in increasing order, and a - indicates that the values from the named field should be sorted in decreasing order. If the direction specifier is not given, + will be assumed. If a field given as part of the sorting specification does not exist or is not a saved field, that field will be ignored for the purposes of sorting.

manager - a partition manager. This is used to retrieve the field information for each of the named fields.

SortSpec

public SortSpec(SortSpec ss,
                InvFileDiskPartition part)
Constructs a partition specific sorting specification that includes fetchers for the saved fields appearing in the sorting specification.

Method Detail

getDirection

public boolean getDirection(int i)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object