Class LuceneFieldComparator

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

public class LuceneFieldComparator extends Object implements 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.
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:
  • Field Details

    • ASCENDING

      public static final int ASCENDING
      Deprecated.
      Used to sort in ascending order.
      See Also:
    • DESCENDING

      public static final int DESCENDING
      Deprecated.
      Used to sort in descending order.
      See Also:
  • Constructor Details

    • 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 Details

    • 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.