Codec Factory

A codecFactory can be specified in solrconfig.xml to determine which Lucene {lucene-javadocs}/core/org/apache/lucene/codecs/Codec.html[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.


The {solr-javadocs}/solr-core/org/apache/solr/core/SchemaCodecFactory.html[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


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


This factory for Lucene’s {solr-javadocs}/solr-core/org/apache/solr/core/SimpleTextCodecFactory.html[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.


<codecFactory class="solr.SimpleTextCodecFactory"/>