Package org.apache.lucene.index
Class SortFieldProvider
java.lang.Object
org.apache.lucene.index.SortFieldProvider
- All Implemented Interfaces:
NamedSPILoader.NamedSPI
- Direct Known Subclasses:
SortedNumericSortField.Provider
,SortedSetSortField.Provider
,SortField.Provider
Reads/Writes a named SortField from a segment info file, used to record index sorts
-
Field Summary
-
Constructor Summary
ModifierConstructorDescriptionprotected
SortFieldProvider
(String name) Creates a new SortFieldProvider. -
Method Summary
Modifier and TypeMethodDescriptionLists all available SortFieldProvidersstatic SortFieldProvider
Looks up a SortFieldProvider by namegetName()
abstract SortField
Reads a SortField from serialized bytesstatic void
reloadSortFieldProviders
(ClassLoader classLoader) Reloads the SortFieldProvider list from the givenClassLoader
.static void
write
(SortField sf, DataOutput output) Writes a SortField to a DataOutputabstract void
writeSortField
(SortField sf, DataOutput out) Writes a SortField to a DataOutput
-
Field Details
-
name
The name this SortFieldProvider is registered under
-
-
Constructor Details
-
SortFieldProvider
Creates a new SortFieldProvider.The provided name will be written into the index segment: in order to for the segment to be read this class should be registered with Java's SPI mechanism (registered in META-INF/ of your jar file, etc).
- Parameters:
name
- must be all ascii alphanumeric, and less than 128 characters in length.
-
-
Method Details
-
forName
Looks up a SortFieldProvider by name -
availableSortFieldProviders
Lists all available SortFieldProviders -
reloadSortFieldProviders
Reloads the SortFieldProvider list from the givenClassLoader
. Changes to the list are visible after the method ends, all iterators (availableSortFieldProviders()
()},...) stay consistent.NOTE: Only new SortFieldProviders are added, existing ones are never removed or replaced.
This method is expensive and should only be called for discovery of new SortFieldProviders on the given classpath/classloader!
-
write
Writes a SortField to a DataOutput- Throws:
IOException
-
getName
- Specified by:
getName
in interfaceNamedSPILoader.NamedSPI
-
readSortField
Reads a SortField from serialized bytes- Throws:
IOException
-
writeSortField
Writes a SortField to a DataOutputThis is used to record index sort information in segment headers
- Throws:
IOException
-