[ 
https://issues.apache.org/jira/browse/SOLR-13360?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17079575#comment-17079575
 ] 

Jason Hildebrand edited comment on SOLR-13360 at 4/9/20, 5:13 PM:
------------------------------------------------------------------

I have reproduced this issue against 8.4 and 8.5.0.  Through trial and error I 
have reduced the number of records and the amount of configuration necessary to 
reproduce. 

I have attached my managed-schema and resources.json files.

The only change I made to the default solrconfig.xml is to define this 
requestHandler:

<requestHandler name="/spellcheck" class="solr.SearchHandler" startup="lazy">
   <lst name="defaults">
     <str name="echoParams">explicit</str>
     <str name="wt">json</str>
     <str name="spellcheck">true</str>
     <str name="spellcheck.dictionary">default</str>
     <str name="spellcheck.alternativeTermCount">1</str>
     <str name="spellcheck.maxResultsForSuggest">5</str>
     <str name="spellcheck.collate">true</str>
     <str name="spellcheck.collateExtendedResults">true</str>
     <str name="spellcheck.maxCollationTries">1000</str>
     <str name="spellcheck.maxCollations">5</str>
   </lst>
   <arr name="components">
     <str>spellcheck</str>
   </arr>
 </requestHandler>

 

After creating a fresh core with this config, reproduce using these commands: 

 
{code:java}
curl 'http://localhost:8983/solr/mycore/update/json?commit=true' --data-binary 
@resources.json -H 'Content-type:application/json'

curl -X PUT -H 'Content-type:application/json' --data-binary '["financial 
stewardship", "fundraising"]' 
http://localhost:8983/solr/mycore/schema/analysis/synonyms/english
curl 'http://localhost:8983/solr/admin/cores?action=RELOAD&core=mycore'
curl 
'http://localhost:8983/solr/mycore/spellcheck?spellcheck.q=financial%20stewardship%20theory'
{code}
 

The error I get is:
{code:java}
java.lang.StringIndexOutOfBoundsException: start -12, end 9, length 16
 at java.base/java.lang.AbstractStringBuilder.checkRangeSIOOBE(Unknown Source)
 at java.base/java.lang.AbstractStringBuilder.replace(Unknown Source)
 at java.base/java.lang.StringBuilder.replace(Unknown Source)
 at 
org.apache.solr.spelling.SpellCheckCollator.getCollation(SpellCheckCollator.java:252)
 at 
org.apache.solr.spelling.SpellCheckCollator.collate(SpellCheckCollator.java:94)
 at 
org.apache.solr.handler.component.SpellCheckComponent.addCollationsToResponse(SpellCheckComponent.java:297)
 at 
org.apache.solr.handler.component.SpellCheckComponent.process(SpellCheckComponent.java:209)
 at 
org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:328)
 at 
org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:211)
.... omitted
{code}
 

Hopefully I haven't missed anything.  Let me know if there is any more info 
that you need to reproduce on your end.

 


was (Author: jason.hildebrand):
I have reproduced this issue against 8.4 and 8.5.0.  Through trial and error I 
have reduce the number of records and the amount of configuration necessary to 
reproduce. 

I have attached my managed-schema and resources.json files.

The only change I made to the default solrconfig.xml is to define this 
requestHandler:

<requestHandler name="/spellcheck" class="solr.SearchHandler" startup="lazy">
  <lst name="defaults">
    <str name="echoParams">explicit</str>
    <str name="wt">json</str>
    <str name="spellcheck">true</str>
    <str name="spellcheck.dictionary">default</str>
    <str name="spellcheck.alternativeTermCount">1</str>
    <str name="spellcheck.maxResultsForSuggest">5</str>
    <str name="spellcheck.collate">true</str>
    <str name="spellcheck.collateExtendedResults">true</str>
    <str name="spellcheck.maxCollationTries">1000</str>
    <str name="spellcheck.maxCollations">5</str>
  </lst>
  <arr name="components">
    <str>spellcheck</str>
  </arr>
 </requestHandler>

 

After creating a fresh core with this config, reproduce using these commands: 

 
{code:java}
curl 'http://localhost:8983/solr/mycore/update/json?commit=true' --data-binary 
@resources.json -H 'Content-type:application/json'

curl -X PUT -H 'Content-type:application/json' --data-binary '["financial 
stewardship", "fundraising"]' 
http://localhost:8983/solr/mycore/schema/analysis/synonyms/english
curl 'http://localhost:8983/solr/admin/cores?action=RELOAD&core=mycore'
curl 
'http://localhost:8983/solr/mycore/spellcheck?spellcheck.q=financial%20stewardship%20theory'
{code}
 

The error I get is:

 
{code:java}
java.lang.StringIndexOutOfBoundsException: start -12, end 9, length 16
 at java.base/java.lang.AbstractStringBuilder.checkRangeSIOOBE(Unknown Source)
 at java.base/java.lang.AbstractStringBuilder.replace(Unknown Source)
 at java.base/java.lang.StringBuilder.replace(Unknown Source)
 at 
org.apache.solr.spelling.SpellCheckCollator.getCollation(SpellCheckCollator.java:252)
 at 
org.apache.solr.spelling.SpellCheckCollator.collate(SpellCheckCollator.java:94)
 at 
org.apache.solr.handler.component.SpellCheckComponent.addCollationsToResponse(SpellCheckComponent.java:297)
 at 
org.apache.solr.handler.component.SpellCheckComponent.process(SpellCheckComponent.java:209)
 at 
org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:328)
 at 
org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:211)
.... omitted
{code}
 

 

Hopefully I haven't missed anything.  Let me know if there is any more info 
that you need to reproduce on your end.

 

> StringIndexOutOfBoundsException: String index out of range: -3
> --------------------------------------------------------------
>
>                 Key: SOLR-13360
>                 URL: https://issues.apache.org/jira/browse/SOLR-13360
>             Project: Solr
>          Issue Type: Bug
>    Affects Versions: 7.2.1
>         Environment: Solr 7.2.1 - SAP Hybris 6.7.0.8
>            Reporter: Ahmed Ghoneim
>            Priority: Critical
>         Attachments: managed-schema, resources.json
>
>
> *{color:#ff0000}I cannot execute the following query:{color}*
> {noformat}
> http://localhost:8983/solr/master_Project_Product_flip/suggest?q=duotop&spellcheck.q=duotop&qt=/suggest&spellcheck.dictionary=de&spellcheck.collate=true{noformat}
> 4/1/2019, 1:16:07 PM ERROR true RequestHandlerBase 
> java.lang.StringIndexOutOfBoundsException: String index out of range: -3
> {code:java}
> java.lang.StringIndexOutOfBoundsException: String index out of range: -3
>       at 
> java.lang.AbstractStringBuilder.replace(AbstractStringBuilder.java:851)
>       at java.lang.StringBuilder.replace(StringBuilder.java:262)
>       at 
> org.apache.solr.spelling.SpellCheckCollator.getCollation(SpellCheckCollator.java:252)
>       at 
> org.apache.solr.spelling.SpellCheckCollator.collate(SpellCheckCollator.java:94)
>       at 
> org.apache.solr.handler.component.SpellCheckComponent.addCollationsToResponse(SpellCheckComponent.java:297)
>       at 
> org.apache.solr.handler.component.SpellCheckComponent.process(SpellCheckComponent.java:209)
>       at 
> org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:295)
>       at 
> org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:177)
>       at org.apache.solr.core.SolrCore.execute(SolrCore.java:2503)
>       at org.apache.solr.servlet.HttpSolrCall.execute(HttpSolrCall.java:710)
>       at org.apache.solr.servlet.HttpSolrCall.call(HttpSolrCall.java:516)
>       at 
> org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:382)
>       at 
> org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:326)
>       at 
> org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1751)
>       at 
> org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:582)
>       at 
> org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
>       at 
> org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548)
>       at 
> org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:226)
>       at 
> org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1180)
>       at 
> org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:512)
>       at 
> org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
>       at 
> org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1112)
>       at 
> org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
>       at 
> org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:213)
>       at 
> org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:119)
>       at 
> org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134)
>       at 
> org.eclipse.jetty.rewrite.handler.RewriteHandler.handle(RewriteHandler.java:335)
>       at 
> org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134)
>       at org.eclipse.jetty.server.Server.handle(Server.java:534)
>       at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:320)
>       at 
> org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:251)
>       at 
> org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:283)
>       at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:108)
>       at 
> org.eclipse.jetty.io.ssl.SslConnection.onFillable(SslConnection.java:251)
>       at 
> org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:283)
>       at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:108)
>       at 
> org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:93)
>       at 
> org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.executeProduceConsume(ExecuteProduceConsume.java:303)
>       at 
> org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceConsume(ExecuteProduceConsume.java:148)
>       at 
> org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:136)
>       at 
> org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:671)
>       at 
> org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:589)
>       at java.lang.Thread.run(Thread.java:748)
> {code}
> 4/1/2019, 1:16:07 PM ERROR true HttpSolrCall 
> null:java.lang.StringIndexOutOfBoundsException: String index out of range: -3
> {code:java}
> null:java.lang.StringIndexOutOfBoundsException: String index out of range: -3
>       at 
> java.lang.AbstractStringBuilder.replace(AbstractStringBuilder.java:851)
>       at java.lang.StringBuilder.replace(StringBuilder.java:262)
>       at 
> org.apache.solr.spelling.SpellCheckCollator.getCollation(SpellCheckCollator.java:252)
>       at 
> org.apache.solr.spelling.SpellCheckCollator.collate(SpellCheckCollator.java:94)
>       at 
> org.apache.solr.handler.component.SpellCheckComponent.addCollationsToResponse(SpellCheckComponent.java:297)
>       at 
> org.apache.solr.handler.component.SpellCheckComponent.process(SpellCheckComponent.java:209)
>       at 
> org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:295)
>       at 
> org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:177)
>       at org.apache.solr.core.SolrCore.execute(SolrCore.java:2503)
>       at org.apache.solr.servlet.HttpSolrCall.execute(HttpSolrCall.java:710)
>       at org.apache.solr.servlet.HttpSolrCall.call(HttpSolrCall.java:516)
>       at 
> org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:382)
>       at 
> org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:326)
>       at 
> org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1751)
>       at 
> org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:582)
>       at 
> org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
>       at 
> org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548)
>       at 
> org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:226)
>       at 
> org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1180)
>       at 
> org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:512)
>       at 
> org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
>       at 
> org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1112)
>       at 
> org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
>       at 
> org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:213)
>       at 
> org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:119)
>       at 
> org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134)
>       at 
> org.eclipse.jetty.rewrite.handler.RewriteHandler.handle(RewriteHandler.java:335)
>       at 
> org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134)
>       at org.eclipse.jetty.server.Server.handle(Server.java:534)
>       at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:320)
>       at 
> org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:251)
>       at 
> org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:283)
>       at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:108)
>       at 
> org.eclipse.jetty.io.ssl.SslConnection.onFillable(SslConnection.java:251)
>       at 
> org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:283)
>       at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:108)
>       at 
> org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:93)
>       at 
> org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.executeProduceConsume(ExecuteProduceConsume.java:303)
>       at 
> org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceConsume(ExecuteProduceConsume.java:148)
>       at 
> org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:136)
>       at 
> org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:671)
>       at 
> org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:589)
>       at java.lang.Thread.run(Thread.java:748){code}
> *{color:#14892c}However the following query works:{color}*
> {noformat}
> http://localhost:8983/solr/master_Project_Product_flip/suggest?q=duotop&spellcheck.q=duotop&qt=/suggest&spellcheck.dictionary=de&spellcheck.collate=false{noformat}
> Note: there's a synonym
> {noformat}
> duotop -> Duo Top
> {noformat}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org

Reply via email to