Solr
  1. Solr
  2. SOLR-1381

Highlighter throws null pointer exception when field has termPositions=true

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.4
    • Component/s: highlighter
    • Labels:
      None
    • Environment:

      freshly installed solr-nightly build (2009-08-25)

      Description

      Highlighting does not work when a field that is used to be highlightened has the attribute termPositions="true".
      Steps to reproduce the problem:
      1. use the original data and config files and add termPositions="true" to the field "name" in schema.xml
      2. post the example files.
      3. do the request: http://localhost:8983/solr/select/?q=solr&version=2.2&start=0&rows=10&indent=on&hl=on&hl.fl=name
      4. get this

      null

      java.lang.NullPointerException
      at org.apache.solr.highlight.TermOffsetsTokenStream$1.next(DefaultSolrHighlighter.java:448)
      at org.apache.lucene.analysis.TokenStream.incrementToken(TokenStream.java:284)
      at org.apache.lucene.search.highlight.Highlighter.getBestTextFragments(Highlighter.java:246)
      at org.apache.solr.highlight.DefaultSolrHighlighter.doHighlighting(DefaultSolrHighlighter.java:321)
      at org.apache.solr.handler.component.HighlightComponent.process(HighlightComponent.java:89)
      at org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:195)
      at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:131)
      at org.apache.solr.core.SolrCore.execute(SolrCore.java:1299)
      at org.apache.solr.servlet.SolrDispatchFilter.execute(SolrDispatchFilter.java:338)
      at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:241)
      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)

      1. SOLR-1381.patch
        4 kB
        Grant Ingersoll

        Activity

        Hide
        Grant Ingersoll added a comment -

        Bulk close for Solr 1.4

        Show
        Grant Ingersoll added a comment - Bulk close for Solr 1.4
        Hide
        Grant Ingersoll added a comment -

        Committed revision 813512.

        Show
        Grant Ingersoll added a comment - Committed revision 813512.
        Hide
        Grant Ingersoll added a comment -

        Improves the handling to deal with TokenSources returning null when offsets aren't present.

        Show
        Grant Ingersoll added a comment - Improves the handling to deal with TokenSources returning null when offsets aren't present.
        Hide
        Thorsten Fischer added a comment -

        This is only a problem when a term is found. e.g. when q=foobar, then there is no exception, just the expected (empty) response

        Show
        Thorsten Fischer added a comment - This is only a problem when a term is found. e.g. when q=foobar, then there is no exception, just the expected (empty) response
        Hide
        Mark Miller added a comment -

        Thanks for the detailed report! I've switched to fix 1.4 so this gets addressed before release.

        Show
        Mark Miller added a comment - Thanks for the detailed report! I've switched to fix 1.4 so this gets addressed before release.

          People

          • Assignee:
            Grant Ingersoll
            Reporter:
            Thorsten Fischer
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development