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).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.
Note
This API is experimental and might change in incompatible ways in the next release.
Inheritance
Inherited Members
Namespace: Lucene.Net.Codecs
Assembly: Lucene.Net.dll
Syntax
public abstract class PostingsFormat
Constructors
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 ScanForPostingsFormats(Assembly) in the class constructor. The new IPostingsFormatFactory can be registered by calling SetPostingsFormatFactory(IPostingsFormatFactory) at application startup.Declaration
protected PostingsFormat()
See Also
Fields
EMPTY
Zero-length PostingsFormat array.
Declaration
public static readonly PostingsFormat[] EMPTY
Field Value
Type | Description |
---|---|
PostingsFormat[] |
See Also
Properties
AvailablePostingsFormats
Returns a list of all available format names.
Declaration
public static ICollection<string> AvailablePostingsFormats { get; }
Property Value
Type | Description |
---|---|
ICollection<string> |
See Also
Name
Returns this posting format's name.
Declaration
public string Name { get; }
Property Value
Type | Description |
---|---|
string |
See Also
Methods
FieldsConsumer(SegmentWriteState)
Writes a new segment.
Declaration
public abstract FieldsConsumer FieldsConsumer(SegmentWriteState state)
Parameters
Type | Name | Description |
---|---|---|
SegmentWriteState | state |
Returns
Type | Description |
---|---|
FieldsConsumer |
See Also
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 IOException should be thrown by the implementation. IOExceptions are expected and will automatically cause a retry of the segment opening logic with the newly revised segments.
Declaration
public abstract FieldsProducer FieldsProducer(SegmentReadState state)
Parameters
Type | Name | Description |
---|---|---|
SegmentReadState | state |
Returns
Type | Description |
---|---|
FieldsProducer |
See Also
ForName(string)
Looks up a format by name.
Declaration
public static PostingsFormat ForName(string name)
Parameters
Type | Name | Description |
---|---|---|
string | name |
Returns
Type | Description |
---|---|
PostingsFormat |
See Also
GetPostingsFormatFactory()
Gets the associated PostingsFormat factory.
Declaration
public static IPostingsFormatFactory GetPostingsFormatFactory()
Returns
Type | Description |
---|---|
IPostingsFormatFactory | The PostingsFormat factory. |
See Also
SetPostingsFormatFactory(IPostingsFormatFactory)
Sets the IPostingsFormatFactory instance used to instantiate PostingsFormat subclasses.
Declaration
public static void SetPostingsFormatFactory(IPostingsFormatFactory postingsFormatFactory)
Parameters
Type | Name | Description |
---|---|---|
IPostingsFormatFactory | postingsFormatFactory | The new IPostingsFormatFactory. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | The |
See Also
ToString()
Returns a string that represents the current object.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
string | A string that represents the current object. |