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, Solr’s SchemaCodecFactory is implicitly used as if it had been defined with no configuration options:

<codecFactory class="solr.SchemaCodecFactory" />

Available Codec Factories

solr.LuceneDefaultCodecFactory

The solr.LuceneDefaultCodecFactory Uses the Lucene Codec.getDefault() and does not support any configuration options.

Example:

<codecFactory class="solr.LuceneDefaultCodecFactory" />

solr.SchemaCodecFactory (default)

The solr.SchemaCodecFactory defaults to the same behavior as Lucene’s default Codec, but supports 2 additional key features:

  • Schema based per-fieldtype customizations:

    • docValuesFormat and postingsFormat on any field type - see the Field Type Properties section for more details.

    • Support for DenseVectorField customizations to the KnnVectorsFormat - see the Dense Vector Search 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"/>