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
public abstract class SortFieldProvider extends java.lang.Object implements NamedSPILoader.NamedSPI
Reads/Writes a named SortField from a segment info file, used to record index sorts
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classSortFieldProvider.Holder
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.StringnameThe name this SortFieldProvider is registered under
-
Constructor Summary
Constructors Modifier Constructor Description protectedSortFieldProvider(java.lang.String name)Creates a new SortFieldProvider.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static java.util.Set<java.lang.String>availableSortFieldProviders()Lists all available SortFieldProvidersstatic SortFieldProviderforName(java.lang.String name)Looks up a SortFieldProvider by namejava.lang.StringgetName()abstract SortFieldreadSortField(DataInput in)Reads a SortField from serialized bytesstatic voidreloadSortFieldProviders(java.lang.ClassLoader classLoader)Reloads the SortFieldProvider list from the givenClassLoader.static voidwrite(SortField sf, DataOutput output)Writes a SortField to a DataOutputabstract voidwriteSortField(SortField sf, DataOutput out)Writes a SortField to a DataOutput This is used to record index sort information in segment headers
-
-
-
Constructor Detail
-
SortFieldProvider
protected SortFieldProvider(java.lang.String name)
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 Detail
-
forName
public static SortFieldProvider forName(java.lang.String name)
Looks up a SortFieldProvider by name
-
availableSortFieldProviders
public static java.util.Set<java.lang.String> availableSortFieldProviders()
Lists all available SortFieldProviders
-
reloadSortFieldProviders
public static void reloadSortFieldProviders(java.lang.ClassLoader classLoader)
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
public static void write(SortField sf, DataOutput output) throws java.io.IOException
Writes a SortField to a DataOutput- Throws:
java.io.IOException
-
getName
public java.lang.String getName()
- Specified by:
getNamein interfaceNamedSPILoader.NamedSPI
-
readSortField
public abstract SortField readSortField(DataInput in) throws java.io.IOException
Reads a SortField from serialized bytes- Throws:
java.io.IOException
-
writeSortField
public abstract void writeSortField(SortField sf, DataOutput out) throws java.io.IOException
Writes a SortField to a DataOutput This is used to record index sort information in segment headers- Throws:
java.io.IOException
-
-