Cannot change field from DOCS_AND_FREQS_AND_POSITIONS DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS

Errors

The Error

You reload your Opensolr Index or try to index documents and Solr throws:

cannot change field "field_name" from index options=DOCS_AND_FREQS_AND_POSITIONS
to inconsistent index options=DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS

This means the field was originally indexed with one set of "index options," and now your schema (or application) is trying to use a different set. Solr will not allow mixing two different formats in the same index.


What Are Index Options? (The Simple Version)

When Solr indexes a word in a field, it can store different levels of detail about that word:

LEVELS OF DETAIL IN INDEX OPTIONSDOCS"Which documentscontain this word?"+ FREQS"How many timesdoes it appear?"+ POSITIONS"Where in the textis each occurrence?"+ OFFSETS"Exact characterstart and end?"Basic searchRelevancy scoringPhrase queriesFast highlightingOld documents: POSITIONS New documents: POSITIONS + OFFSETSSolr cannot mix these two formats in the same index segmentThe fix: make the field definition consistent and re-index everything.


Why This Happens

Schema Change Without Re-indexing

You (or a module like Drupal Search API) changed the field definition — for example, adding storeOffsetsWithPositions="true" for faster highlighting. The new definition requires OFFSETS, but old documents were indexed without them. Solr cannot mix both.

Drupal Search API Solr

This is especially common with Drupal. The Search API Solr module may set storeOffsetsWithPositions="true" on certain fields automatically when you enable highlighting features. The module generates the schema, and if the generated schema differs from what was previously indexed, you get this error.


How to Fix It

Step 1: Decide Which Index Options You Want

  • DOCS_AND_FREQS_AND_POSITIONS — standard, good for most use cases
  • DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS — needed for fast highlighting (term vectors with offsets)

Step 2: Update Your Schema

Make the field definition consistent. If you want offsets for highlighting:

<field name="your_field" type="text_general" indexed="true"
       stored="true" storeOffsetsWithPositions="true"/>

If you do not need offsets, make sure storeOffsetsWithPositions is false or absent.

Step 3: Reset and Re-Index

After changing the schema, you must clear and rebuild the entire index:

  1. Reset your index from the Opensolr control panel (remove all data)
  2. Reload the Opensolr Index
  3. Re-index all documents from your application

There is no shortcut — old documents with the old format must be replaced.


Quick Reference

Step Action
1. Check field definition Look for storeOffsetsWithPositions in schema
2. Make it consistent Either add or remove offsets — pick one
3. Reload schema Click Reload in Opensolr control panel
4. Wipe the index Reset/delete all indexed documents
5. Re-index Rebuild from your application or CMS
6. Check Drupal settings If using Drupal, verify Search API module options match

Quick Checklist

  • Check your schema for storeOffsetsWithPositions on the affected field
  • Make the field definition consistent — old and new must match
  • Reset your index and re-index all data after the schema change
  • If using Drupal, check the Search API Solr module highlighting settings
  • Always reload the Opensolr Index after schema changes