Alright, I pinned it down, I think...
The cause of the error seems to be the "features" field, which has
termVectors="true", termPositions="true" and termOffsets="true". The other 2
fields ("name" and "text") work, they have the same type but lack the
term*-attributes. When you overwrite the default hl.fl with something like
"name text" it works, but add "features" to it and you get the error.


Steffen B. wrote:
> 
> Hi everyone,
> it seems that I've run into another problem with my Solr setup. :/ The
> highlighter just won't highlight anything, no matter which fragmenter or
> config params I use.
> Here's an example, taken straight out of the example solrconfig.xml:
> <requestHandler name="dismax" class="solr.SearchHandler" >
>     <lst name="defaults">
>      <str name="defType">dismax</str>
>      <str name="echoParams">explicit</str>
>      <float name="tie">0.01</float>
>      <str name="qf">
>         text^0.5 features^1.0 name^1.2 sku^1.5 id^10.0 manu^1.1 cat^1.4
>      </str>
>      <str name="pf">
>         text^0.2 features^1.1 name^1.5 manu^1.4 manu_exact^1.9
>      </str>
>      <str name="bf">
>         ord(popularity)^0.5 recip(rord(price),1,1000,1000)^0.3
>      </str>
>      <str name="fl">
>         id,name,price,score
>      </str>
>      <str name="mm">
>         2&lt;-1 5&lt;-2 6&lt;90%
>      </str>
>      <int name="ps">100</int>
>      <str name="q.alt">*:*</str>
>      <!-- example highlighter config, enable per-query with hl=true -->
>      <str name="hl.fl">text features name</str>
>      <!-- for this field, we want no fragmenting, just highlighting -->
>      <str name="f.name.hl.fragsize">0</str>
>      <!-- instructs Solr to return the field itself if no query terms are
>           found -->
>      <str name="f.name.hl.alternateField">name</str>
>      <str name="f.text.hl.fragmenter">regex</str> <!-- defined below -->
>     </lst>
>   </requestHandler>
> 
> Whenever I try to activate the highlighter, it produces an error:
> http://localhost:8983/solr/select/?q=ipod&version=2.2&start=0&rows=10&indent=on&qt=dismax&hl=true
> 
> HTTP ERROR: 500
> 
> String index out of range: 35
> 
> java.lang.StringIndexOutOfBoundsException: String index out of range: 35
>       at java.lang.String.substring(Unknown Source)
>       at
> org.apache.lucene.search.highlight.Highlighter.getBestTextFragments(Highlighter.java:239)
>       at
> org.apache.solr.highlight.DefaultSolrHighlighter.doHighlighting(DefaultSolrHighlighter.java:310)
>       at
> org.apache.solr.handler.component.HighlightComponent.process(HighlightComponent.java:83)
>       at
> org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:171)
>       at
> org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:131)
>       at org.apache.solr.core.SolrCore.execute(SolrCore.java:1313)
>       at
> org.apache.solr.servlet.SolrDispatchFilter.execute(SolrDispatchFilter.java:303)
>       at
> org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:232)
>       at
> org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1089)
>       at
> org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:365)
>       at
> org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
>       at
> org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
>       at
> org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:712)
>       at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
>       at
> org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:211)
>       at
> org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
>       at
> org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139)
>       at org.mortbay.jetty.Server.handle(Server.java:285)
>       at
> org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:502)
>       at
> org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:821)
>       at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:513)
>       at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:208)
>       at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:378)
>       at
> org.mortbay.jetty.bio.SocketConnector$Connection.run(SocketConnector.java:226)
>       at
> org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:442)
> 
> That's what happens with the example setup - on my project it simply won't
> highlight anything at all, no matter what I try. :| Can anyone shed some
> light on this?
> 

-- 
View this message in context: 
http://www.nabble.com/Highlighting-broken--String-index-out-of-range%3A-35-tp21073102p21073356.html
Sent from the Solr - User mailing list archive at Nabble.com.

Reply via email to