Class Codec
Encodes/decodes an inverted index segment.
Note, when extending this class, the name (Name) is written into the index. In order for the segment to be read, the name must resolve to your implementation via ForName(string). This method uses GetCodec(string) to resolve codec names. To implement your own codec:- Subclass this class.
- Subclass DefaultCodecFactory, override the Initialize() method,
and add the line
base.ScanForCodecs(typeof(YourCodec).Assembly)
. If you have any codec classes in your assembly that are not meant for reading, you can add the ExcludeCodecFromScanAttribute to them so they are ignored by the scan. - set the new ICodecFactory by calling SetCodecFactory(ICodecFactory) at application startup.
Inheritance
Inherited Members
Namespace: Lucene.Net.Codecs
Assembly: Lucene.Net.dll
Syntax
public abstract class Codec
Constructors
Codec()
Creates a new codec.
The Name will be written into the index segment: in order for the segment to be read this class should be registered by subclassing DefaultCodecFactory and calling ScanForCodecs(Assembly) in the class constructor. The new ICodecFactory can be registered by calling SetCodecFactory(ICodecFactory) at application startup.Declaration
protected Codec()
See Also
Properties
AvailableCodecs
Returns a list of all available codec names.
Declaration
public static ICollection<string> AvailableCodecs { get; }
Property Value
Type | Description |
---|---|
ICollection<string> |
See Also
Default
Expert: returns the default codec used for newly created IndexWriterConfigs.
Declaration
public static Codec Default { get; set; }
Property Value
Type | Description |
---|---|
Codec |
See Also
DocValuesFormat
Encodes/decodes docvalues.
Declaration
public abstract DocValuesFormat DocValuesFormat { get; }
Property Value
Type | Description |
---|---|
DocValuesFormat |
See Also
FieldInfosFormat
Encodes/decodes field infos file.
Declaration
public abstract FieldInfosFormat FieldInfosFormat { get; }
Property Value
Type | Description |
---|---|
FieldInfosFormat |
See Also
LiveDocsFormat
Encodes/decodes live docs.
Declaration
public abstract LiveDocsFormat LiveDocsFormat { get; }
Property Value
Type | Description |
---|---|
LiveDocsFormat |
See Also
Name
Returns this codec's name.
Declaration
public string Name { get; }
Property Value
Type | Description |
---|---|
string |
See Also
NormsFormat
Encodes/decodes document normalization values.
Declaration
public abstract NormsFormat NormsFormat { get; }
Property Value
Type | Description |
---|---|
NormsFormat |
See Also
PostingsFormat
Encodes/decodes postings.
Declaration
public abstract PostingsFormat PostingsFormat { get; }
Property Value
Type | Description |
---|---|
PostingsFormat |
See Also
SegmentInfoFormat
Encodes/decodes segment info file.
Declaration
public abstract SegmentInfoFormat SegmentInfoFormat { get; }
Property Value
Type | Description |
---|---|
SegmentInfoFormat |
See Also
StoredFieldsFormat
Encodes/decodes stored fields.
Declaration
public abstract StoredFieldsFormat StoredFieldsFormat { get; }
Property Value
Type | Description |
---|---|
StoredFieldsFormat |
See Also
TermVectorsFormat
Encodes/decodes term vectors.
Declaration
public abstract TermVectorsFormat TermVectorsFormat { get; }
Property Value
Type | Description |
---|---|
TermVectorsFormat |
See Also
Methods
ForName(string)
Looks up a codec by name.
Declaration
public static Codec ForName(string name)
Parameters
Type | Name | Description |
---|---|---|
string | name |
Returns
Type | Description |
---|---|
Codec |
See Also
GetCodecFactory()
Gets the associated codec factory.
Declaration
public static ICodecFactory GetCodecFactory()
Returns
Type | Description |
---|---|
ICodecFactory | The codec factory. |
See Also
SetCodecFactory(ICodecFactory)
Sets the ICodecFactory instance used to instantiate Codec subclasses.
Declaration
public static void SetCodecFactory(ICodecFactory codecFactory)
Parameters
Type | Name | Description |
---|---|---|
ICodecFactory | codecFactory | The new ICodecFactory. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | The |
See Also
ToString()
Returns the codec's name. Subclasses can override to provide more detail (such as parameters).
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
string |