title: Solr indexing error - possible analysis error
body: <p>I just got an Solr 6.6.1 indexing error. Can you please help to figure out whether or nor this is a Solr defect? or is it just my configuration issue? </p>
  
  <p>When I remove the stopword "pm", the indexing goes fine. I guess the stopword filter did something that makes the SynonymGraphFilter glitched. </p>
  
  <p><strong>The value I used for indexing is</strong> "Fridays:  7:00pm-11:30pm  Saturdays:  1:30pm-4:00pm and 7:00pm-11:30pm  Sundays".</p>
  
  <p><strong>The schema I used</strong>: </p>
  
  <pre><code>&lt;field indexed="true" multiValued="false" name="my_field" type="my_field_type" omitNorms="true" omitPositions="false" omitTermFreqAndPositions="false" storeOffsetsWithPositions="true" stored="true" termVectors="false"/&gt;
  
  &lt;fieldType class="solr.TextField" name="my_field_type" positionIncrementGap="100"&gt;
        &lt;analyzer&gt;
          &lt;tokenizer class="solr.WhitespaceTokenizerFactory"/&gt;
          &lt;filter class="solr.LowerCaseFilterFactory"/&gt;
          &lt;filter class="solr.ASCIIFoldingFilterFactory"/&gt;
          &lt;filter class="solr.WordDelimiterGraphFilterFactory"
              generateWordParts="1" generateNumberParts="1"
              catenateWords="1" catenateNumbers="1"
              catenateAll="1" splitOnCaseChange="0"
              stemEnglishPossessive="1" preserveOriginal="1"/&gt;
          &lt;filter class="solr.FlattenGraphFilterFactory"/&gt;
          &lt;filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt"/&gt;
          &lt;filter class="solr.SynonymGraphFilterFactory" expand="true" ignoreCase="true" synonyms="synonyms.txt"/&gt;
      &lt;filter class="solr.FlattenGraphFilterFactory"/&gt;
    &lt;/analyzer&gt;
  &lt;/fieldType&gt;
  </code></pre>
  
  <p><strong>Inside stopwords.txt:</strong> pm</p>
  
  <p><strong>Inside synonyms.txt:</strong> qweasdzxc => abc</p>
  
  <p><strong>The error message from Solr log</strong>:</p>
  
  <pre><code>org.apache.solr.common.SolrException: Exception writing document id 312310-003690 to the index; possible analysis error.
      at         org.apache.solr.update.DirectUpdateHandler2.addDoc(DirectUpdateHandler2.java:206)
  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.doLocalAdd(DistributedUpdateProcessor.java:979)
  at     org.apache.solr.update.processor.DistributedUpdateProcessor.versionAdd(DistributedUpdateProcessor.java:1192)
  at org.apache.solr.update.processor.DistributedUpdateProcessor.processAdd(DistributedUpdateProcessor.java:748)
  at org.apache.solr.update.processor.LogUpdateProcessorFactory$LogUpdateProcessor.processAdd(LogUpdateProcessorFactory.java:103)
  at org.apache.solr.handler.dataimport.SolrWriter.upload(SolrWriter.java:80)
  at org.apache.solr.handler.dataimport.DataImportHandler$1.upload(DataImportHandler.java:254)
  at org.apache.solr.handler.dataimport.DocBuilder.buildDocument(DocBuilder.java:526)
  at org.apache.solr.handler.dataimport.DocBuilder.buildDocument(DocBuilder.java:414)
  at org.apache.solr.handler.dataimport.DocBuilder.doFullDump(DocBuilder.java:329)
  at org.apache.solr.handler.dataimport.DocBuilder.execute(DocBuilder.java:232)
  at org.apache.solr.handler.dataimport.DataImporter.doFullImport(DataImporter.java:415)
  at org.apache.solr.handler.dataimport.DataImporter.runCmd(DataImporter.java:474)
  at org.apache.solr.handler.dataimport.DataImporter.lambda$runAsync$0(DataImporter.java:457)
  at java.lang.Thread.run(Unknown Source)
  
  Caused by: java.lang.IndexOutOfBoundsException: Index: 2, Size: 2
  at java.util.ArrayList.rangeCheck(Unknown Source)
  at java.util.ArrayList.get(Unknown Source)
  at org.apache.lucene.analysis.core.FlattenGraphFilter.releaseBufferedToken(FlattenGraphFilter.java:204)
  at org.apache.lucene.analysis.core.FlattenGraphFilter.incrementToken(FlattenGraphFilter.java:258)
  at org.apache.lucene.analysis.synonym.SynonymGraphFilter.parse(SynonymGraphFilter.java:332)
  at org.apache.lucene.analysis.synonym.SynonymGraphFilter.incrementToken(SynonymGraphFilter.java:199)
  at org.apache.lucene.analysis.core.FlattenGraphFilter.incrementToken(FlattenGraphFilter.java:268)
  at org.apache.lucene.index.DefaultIndexingChain$PerField.invert(DefaultIndexingChain.java:746)
  at org.apache.lucene.index.DefaultIndexingChain.processField(DefaultIndexingChain.java:447)
  at org.apache.lucene.index.DefaultIndexingChain.processDocument(DefaultIndexingChain.java:403)
  at org.apache.lucene.index.DocumentsWriterPerThread.updateDocument(DocumentsWriterPerThread.java:232)
  at org.apache.lucene.index.DocumentsWriter.updateDocument(DocumentsWriter.java:478)
  at org.apache.lucene.index.IndexWriter.updateDocument(IndexWriter.java:1571)
  at org.apache.solr.update.DirectUpdateHandler2.updateDocument(DirectUpdateHandler2.java:924)
  at org.apache.solr.update.DirectUpdateHandler2.updateDocOrDocValues(DirectUpdateHandler2.java:913)
  at org.apache.solr.update.DirectUpdateHandler2.doNormalUpdate(DirectUpdateHandler2.java:302)
  at org.apache.solr.update.DirectUpdateHandler2.addDoc0(DirectUpdateHandler2.java:239)
  at org.apache.solr.update.DirectUpdateHandler2.addDoc(DirectUpdateHandler2.java:194)
  ... 16 more
  </code></pre>