DLESE Tools
v1.6.0

org.dlese.dpc.index
Class LuceneFieldComparator

java.lang.Object
  extended by org.dlese.dpc.index.LuceneFieldComparator
All Implemented Interfaces:
Comparator

Deprecated. Sorting should now be done by supplying a Sort object at search time. Sorting on returned ResultDocs is less efficient and may cause OutOfMemory errors on large result sets.

public class LuceneFieldComparator
extends Object
implements Comparator

Compares two ResultDocs for sorting by a given Lucene field. Fields that are encoded as a Dates will be sorted by Date, all others are sorted lexically. The lucene fields must be stored as text or keyword. The name of the field to be sorted must be passed into the constructor of this LuceneFieldComparator.

Author:
John Weatherley
See Also:
ResultDoc

Field Summary
static int ASCENDING
          Deprecated. Used to sort in ascending order.
static int DESCENDING
          Deprecated. Used to sort in descending order.
 
Constructor Summary
LuceneFieldComparator(String fieldName, int sortOrder)
          Deprecated. Sorting should now be done by supplying a Sort object at search time. Sorting on returned ResultDocs is less efficient and may cause OutOfMemory errors on large result sets.
 
Method Summary
 int compare(Object o1, Object o2)
          Deprecated. Compares two ResultDocs for sorting by a Lucene field, indicated at construction time.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Comparator
equals
 

Field Detail

ASCENDING

public static final int ASCENDING
Deprecated. 
Used to sort in ascending order.

See Also:
Constant Field Values

DESCENDING

public static final int DESCENDING
Deprecated. 
Used to sort in descending order.

See Also:
Constant Field Values
Constructor Detail

LuceneFieldComparator

public LuceneFieldComparator(String fieldName,
                             int sortOrder)
Deprecated. Sorting should now be done by supplying a Sort object at search time. Sorting on returned ResultDocs is less efficient and may cause OutOfMemory errors on large result sets.

Constructor for this LuceneFieldComparator object.

Parameters:
fieldName - Field to sort by
sortOrder - ASCENDING or DESCENDING
Method Detail

compare

public int compare(Object o1,
                   Object o2)
Deprecated. 
Compares two ResultDocs for sorting by a Lucene field, indicated at construction time.

Compares its two arguments for order. Returns a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.

Specified by:
compare in interface Comparator
Parameters:
o1 - The first Object.
o2 - The second Object.
Returns:
An int indicating sort order.

DLESE Tools
v1.6.0