Class DocValuesFormat
Encodes/decodes per-document values.
Note, when extending this class, the name (Name) may written into the index in certain configurations. In order for the segment to be read, the name must resolve to your implementation via ForName(String). This method uses GetDocValuesFormat(String) to resolve format names.
To implement your own format:
- Subclass this class.
- Subclass DefaultDocValuesFormatFactory, override the Initialize() method,
and add the line
base.ScanForDocValuesFormats(typeof(YourDocValuesFormat).GetTypeInfo().Assembly)
. If you have any format classes in your assembly that are not meant for reading, you can add the ExcludeDocValuesFormatFromScanAttribute to them so they are ignored by the scan. - Set the new IDocValuesFormatFactory by calling SetDocValuesFormatFactory(IDocValuesFormatFactory) at application startup.
DocValuesFormat Names
Unlike the Java version, format names are by default convention-based on the class name. If you name your custom format class "MyCustomDocValuesFormat", the format name will the same name without the "DocValuesFormat" suffix: "MyCustom".
You can override this default behavior by using the DocValuesFormatNameAttribute to name the format differently than this convention. Format names must be all ASCII alphanumeric, and less than 128 characters in length.
@lucene.experimental
Inheritance
Assembly: DistributedLucene.Net.dll
Syntax
public abstract class DocValuesFormat : object
Constructors
Name | Description |
---|---|
DocValuesFormat() | Creates a new docvalues format.
The provided name will be written into the index segment in some configurations
(such as when using PerFieldDocValuesFormat): in such configurations,
for the segment to be read this class should be registered by subclassing DefaultDocValuesFormatFactory and
calling |
Properties
Name | Description |
---|---|
Name | Unique name that's used to retrieve this format when reading the index. |
Methods
Name | Description |
---|---|
AvailableDocValuesFormats() | Returns a list of all available format names. |
FieldsConsumer(SegmentWriteState) | Returns a DocValuesConsumer to write docvalues to the index. |
FieldsProducer(SegmentReadState) | Returns a DocValuesProducer to read docvalues from the index.
NOTE: by the time this call returns, it must hold open any files it will
need to use; else, those files may be deleted. Additionally, required files
may be deleted during the execution of this call before there is a chance
to open them. Under these circumstances an |
ForName(String) | Looks up a format by name. |
GetDocValuesFormatFactory() | Gets the associated DocValuesFormat factory. |
SetDocValuesFormatFactory(IDocValuesFormatFactory) | Sets the IDocValuesFormatFactory instance used to instantiate DocValuesFormat subclasses. |
ToString() |