Package org.apache.lucene.search

# Class SimpleFieldComparator<T>

java.lang.Object
org.apache.lucene.search.FieldComparator<T>
org.apache.lucene.search.SimpleFieldComparator<T>

All Implemented Interfaces:
  `LeafFieldComparator`

public abstract class SimpleFieldComparator<T> extends FieldComparator<T> implements LeafFieldComparator
Base `FieldComparator` implementation that is used for all contexts.

WARNING: This API is experimental and might change in incompatible ways in the next release.

## Nested Class Summary

## Nested classes/interfaces inherited from class org.apache.lucene.search.FieldComparator

`FieldComparator.RelevanceComparator, FieldComparator.TermValComparator`

## Constructor Summary

Constructors
Constructor
Description
`SimpleFieldComparator()`

## Method Summary

Modifier and Type
Method
Description
`protected abstract void`
`doSetNextReader(LeafReaderContext context)`
This method is called before collecting `context`.
`final LeafFieldComparator`
`getLeafComparator(LeafReaderContext context)`
Get a per-segment `LeafFieldComparator` to collect the given `LeafReaderContext`.
`void`
`setScorer(Scorable scorer)`
Sets the Scorer to use in case a document's score is needed.

### Methods inherited from class org.apache.lucene.search.FieldComparator

`compare, compareValues, disableSkipping, setSingleSort, setTopValue, value`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Methods inherited from interface org.apache.lucene.search.LeafFieldComparator

`compareBottom, compareTop, competitiveIterator, copy, setBottom, setHitsThresholdReached`

## Constructor Details

### SimpleFieldComparator

public SimpleFieldComparator()

## Method Details

### doSetNextReader

protected abstract void doSetNextReader(LeafReaderContext context) throws IOException
This method is called before collecting `context`.

Throws:
  `IOException`

### getLeafComparator

public final LeafFieldComparator getLeafComparator(LeafReaderContext context) throws IOException
Description copied from class: `FieldComparator`
Get a per-segment `LeafFieldComparator` to collect the given `LeafReaderContext`. All docIDs supplied to this `LeafFieldComparator` are relative to the current reader (you must add docBase if you need to map it to a top-level docID).

Specified by:
  `getLeafComparator` in class `FieldComparator<T>`
Parameters:
  `context` - current reader context
Returns:
  the comparator to use for this segment
Throws:
  `IOException` - if there is a low-level IO error

### setScorer

public void setScorer(Scorable scorer) throws IOException
Description copied from interface: `LeafFieldComparator`
Sets the Scorer to use in case a document's score is needed.

Specified by:
  `setScorer` in interface `LeafFieldComparator`
Parameters:
  `scorer` - Scorer instance that you should use to obtain the current hit's score, if necessary.
Throws:
  `IOException`