Codec Factory

A codecFactory can be specified in solrconfig.xml to determine which Lucene Codec is used when writing the index to disk.

If not specified, Lucene’s default codec is implicitly used.

Alternatives to the Default Codec

There are two alternatives to Lucene’s default codec.

solr.SchemaCodecFactory

The solr.SchemaCodecFactory supports 2 key features:

  • Schema based per-fieldtype configuration for docValuesFormat and postingsFormat - see the Field Type Properties section for more details.

  • A compressionMode option:

    • BEST_SPEED (default) is optimized for search speed performance

    • BEST_COMPRESSION is optimized for disk space usage

Example:

<codecFactory class="solr.SchemaCodecFactory">
  <str name="compressionMode">BEST_COMPRESSION</str>
</codecFactory>

solr.SimpleTextCodecFactory

This factory for Lucene’s SimpleTextCodecFactory produces a plain text human-readable index format.

FOR RECREATIONAL USE ONLY. This codec should never be used in production. SimpleTextCodec is relatively slow and takes up a large amount of disk space. Its use should be limited to educational and debugging purposes.

Example:

<codecFactory class="solr.SimpleTextCodecFactory"/>