title: Solr SynonymGraphFilterFactory error on import
body: <p>After upgrading to Solr 7.2 import started to log errors for some documents. </p>
  
  <p>Field that returns errors:</p>
  
  <pre><code>   &lt;fieldType name="text" class="solr.TextField" positionIncrementGap="100"&gt;
    &lt;analyzer type="index"&gt;
      &lt;tokenizer class="solr.StandardTokenizerFactory"/&gt;
      &lt;filter class="solr.SynonymGraphFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/&gt;
      &lt;filter class="solr.FlattenGraphFilterFactory"/&gt;
      &lt;filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" /&gt; 
      &lt;filter class="solr.WordDelimiterGraphFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="1" catenateNumbers="1" catenateAll="0" splitOnCaseChange="1" preserveOriginal="1"/&gt;
      &lt;filter class="solr.LowerCaseFilterFactory"/&gt;
  &lt;filter class="solr.EnglishPossessiveFilterFactory"/&gt;
      &lt;filter class="solr.ASCIIFoldingFilterFactory"/&gt;
      &lt;filter class="solr.EnglishMinimalStemFilterFactory"/&gt;
      &lt;filter class="solr.RemoveDuplicatesTokenFilterFactory"/&gt;
    &lt;/analyzer&gt;
    &lt;analyzer type="query"&gt;
      &lt;tokenizer class="solr.StandardTokenizerFactory"/&gt;
      &lt;filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt"/&gt;
      &lt;filter class="solr.WordDelimiterGraphFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="0" catenateNumbers="0" catenateAll="0" splitOnCaseChange="1"/&gt;
      &lt;filter class="solr.LowerCaseFilterFactory"/&gt;
  &lt;filter class="solr.EnglishPossessiveFilterFactory"/&gt;
      &lt;filter class="solr.ASCIIFoldingFilterFactory"/&gt;
      &lt;filter class="solr.EnglishMinimalStemFilterFactory"/&gt;
      &lt;filter class="solr.RemoveDuplicatesTokenFilterFactory"/&gt;
    &lt;/analyzer&gt;
  &lt;/fieldType&gt;
  </code></pre>
  
  <p>During the import below error is returned for some of the records:</p>
  
  <pre><code>org.apache.solr.common.SolrException: Exception writing document id XXXXX to the index; possible analysis error: startOffset must be non-negative, and endOffset must be &gt;= startOffset, and offsets must not go backwards startOffset=2874,endOffset=2878,lastStartOffset=2879 for field 'XXXXX'
  at g.apache.solr.update.DirectUpdateHandler2.addDoc(DirectUpdateHandler2.java:226)
  at org.apache.solr.update.processor.RunUpdateProcessor.processAdd(RunUpdateProcessorFactory.java:67)
  at org.apache.solr.update.processor.UpdateRequestProcessor.processAdd(UpdateRequestProcessor.java:55)
  at org.apache.solr.update.processor.DistributedUpdateProcessor.versionAdd(DistributedUpdateProcessor.java:936)
  at org.apache.solr.update.processor.DistributedUpdateProcessor.processAdd(DistributedUpdateProcessor.java:616)
  at org.apache.solr.update.processor.LogUpdateProcessorFactory$LogUpdateProcessor.processAdd(LogUpdateProcessorFactory.java:103)
  at org.apache.solr.handler.dataimport.SolrWriter.upload(SolrWriter.java:80)
  </code></pre>
  
  <p>It is related to the </p>
  
  <pre><code>&lt;filter class="solr.SynonymGraphFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/&gt;
  &lt;filter class="solr.FlattenGraphFilterFactory"/&gt;
  </code></pre>
  
  <p>If I remove this it works fine, previously we were using:</p>
  
  <pre><code>&lt;filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/&gt;
  </code></pre>
  
  <p>and it was working fine, but the <strong>SynonymFilterFactory</strong> is not longer supported on the Solr 7.X., it has been replaced with <strong>SynonymGraphFilterFactory</strong>, I have added <strong>FlattenGraphFilterFactory</strong> as suggested.</p>
  
  <p>If the synoyms.txt file is updated from:</p>
  
  <p><em>word, synonym1, synonym2</em> </p>
  
  <p>to</p>
  
  <p><em>word => synonym1, synonym2</em></p>
  
  <p>all is working fine, but </p>
  
  <p><em>word => word, synonym1, synonym2</em>  - does not work.</p>
  
  <p>I am not sure why Solr returns those errors?</p>
  
  <p>Thank you in advance for any suggestions.</p>