Hi,

We're using Solr 5.3.1, and we're getting a StringIndexOutOfBoundsException from the SpellCheckCollator. I've done some investigation, and it looks like the problem is that the corrected string is shorter than the original query.

For example, the search term is "theatre", the suggested correction is "there". The error is being thrown when replacing the original query with the shorter replacement.

This is the stack trace:
java.lang.StringIndexOutOfBoundsException: String index out of range: -2
at java.lang.AbstractStringBuilder.replace(AbstractStringBuilder.java:824)
    at java.lang.StringBuilder.replace(StringBuilder.java:262)
at org.apache.solr.spelling.SpellCheckCollator.getCollation(SpellCheckCollator.java:235) at org.apache.solr.spelling.SpellCheckCollator.collate(SpellCheckCollator.java:92) at org.apache.solr.handler.component.SpellCheckComponent.addCollationsToResponse(SpellCheckComponent.java:237) at org.apache.solr.handler.component.SpellCheckComponent.process(SpellCheckComponent.java:202) at org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:277)

The error looks very similar to those described in https://issues.apache.org/jira/browse/SOLR-4489, https://issues.apache.org/jira/browse/SOLR-3608 and https://issues.apache.org/jira/browse/SOLR-2509, most of which are closed.

Any suggestions would be appreciated, or should I open a JIRA ticket?

Thanks,

Matt

--
Matt Pearce
Flax - Open Source Enterprise Search
www.flax.co.uk

Reply via email to