Search code examples
solrlucenefull-text-search

Solr fails to index text field


When trying to index documents with text_general fields I get the following error:

Exception writing document id 93cf6aeb-54b0-471a-9325-5b8e95801131 to the index; possible analysis error: cannot change field "content" from index options=DOCS to inconsistent index options=DOCS_AND_FREQS_AND_POSITIONS

The document I attempted to index looks as follows:

{
    "filename": "FooBar.pdf",
    "content": "my test"
}

The schema definition for this field is:

  <field name="content" type="text_general" uninvertible="true" indexed="true" required="true" stored="true"/>

With the field type defined as:

<fieldType name="text_general" class="solr.TextField" positionIncrementGap="100" multiValued="true">
    <analyzer type="index">
      <tokenizer class="solr.StandardTokenizerFactory"/>
      <filter class="solr.StopFilterFactory" words="stopwords.txt" ignoreCase="true"/>
      <filter class="solr.LowerCaseFilterFactory"/>
    </analyzer>
    <analyzer type="query">
      <tokenizer class="solr.StandardTokenizerFactory"/>
      <filter class="solr.StopFilterFactory" words="stopwords.txt" ignoreCase="true"/>
      <filter class="solr.SynonymGraphFilterFactory" expand="true" ignoreCase="true" synonyms="synonyms.txt"/>
      <filter class="solr.LowerCaseFilterFactory"/>
    </analyzer>
</fieldType>

How do I succcessfully index a document with a text_general field?


Solution

  • This is caused by there already being content indexed for the field that was indexed with a different field type. Delete the index and re-index your content.