Class PostingsFormat
Encodes/decodes terms, postings, and proximity data.
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 GetPostingsFormat(String) to resolve format names.
If you implement your own format:
- Subclass this class.
- Subclass DefaultPostingsFormatFactory, override Initialize(),
and add the line
base.ScanForPostingsFormats(typeof(YourPostingsFormat).GetTypeInfo().Assembly)
. If you have any format classes in your assembly that are not meant for reading, you can add the ExcludePostingsFormatFromScanAttribute to them so they are ignored by the scan. - Set the new IPostingsFormatFactory by calling SetPostingsFormatFactory(IPostingsFormatFactory) at application startup.
PostingsFormat Names
Unlike the Java version, format names are by default convention-based on the class name. If you name your custom format class "MyCustomPostingsFormat", the codec name will the same name without the "PostingsFormat" suffix: "MyCustom".
You can override this default behavior by using the PostingsFormatNameAttribute 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 PostingsFormat : object
Constructors
Name | Description |
---|---|
PostingsFormat() | Creates a new postings format.
The provided name will be written into the index segment in some configurations
(such as when using PerFieldPostingsFormat): in such configurations,
for the segment to be read this class should be registered by subclassing DefaultPostingsFormatFactory and
calling |
Fields
Name | Description |
---|---|
EMPTY | Zero-length PostingsFormat array. |
Properties
Name | Description |
---|---|
Name | Returns this posting format's name. |
Methods
Name | Description |
---|---|
AvailablePostingsFormats() | Returns a list of all available format names. |
FieldsConsumer(SegmentWriteState) | Writes a new segment. |
FieldsProducer(SegmentReadState) | Reads a segment. 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. |
GetPostingsFormatFactory() | Gets the associated PostingsFormat factory. |
SetPostingsFormatFactory(IPostingsFormatFactory) | Sets the IPostingsFormatFactory instance used to instantiate PostingsFormat subclasses. |
ToString() |