Uploaded image for project: 'Solr'
  1. Solr
  2. SOLR-11883

NPE on missing nested query in QueryValueSource

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 8.1, main (9.0)
    • Component/s: None
    • Labels:
      None

      Description

      When the nested query or query de-referencing is used but the query isn't specified Solr throws NPE.

      For following request,

      http://localhost:8983/solr/blockjoin70001-1492010056/select?q=*&boost=query($qq)&defType=edismax
      

      Solr returned 500 with stack trace

      java.lang.NullPointerException
      	at org.apache.lucene.queries.function.valuesource.QueryValueSource.hashCode(QueryValueSource.java:63)
      	at java.util.Arrays.hashCode(Arrays.java:4146)
      	at java.util.Objects.hash(Objects.java:128)
      	at org.apache.lucene.queries.function.ValueSource$WrappedDoubleValuesSource.hashCode(ValueSource.java:275)
      	at java.util.Arrays.hashCode(Arrays.java:4146)
      	at java.util.Objects.hash(Objects.java:128)
      	at org.apache.lucene.queries.function.FunctionScoreQuery$MultiplicativeBoostValuesSource.hashCode(FunctionScoreQuery.java:269)
      	at java.util.Arrays.hashCode(Arrays.java:4146)
      	at java.util.Objects.hash(Objects.java:128)
      	at org.apache.lucene.queries.function.FunctionScoreQuery.hashCode(FunctionScoreQuery.java:130)
      	at org.apache.solr.search.QueryResultKey.<init>(QueryResultKey.java:46)
      	at org.apache.solr.search.SolrIndexSearcher.getDocListC(SolrIndexSearcher.java:1326)
      	at org.apache.solr.search.SolrIndexSearcher.search(SolrIndexSearcher.java:583)
      	at org.apache.solr.handler.component.QueryComponent.doProcessUngroupedSearch(QueryComponent.java:1435)
      	at org.apache.solr.handler.component.QueryComponent.process(QueryComponent.java:375)
      	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:711)
      	at org.apache.solr.servlet.HttpSolrCall.call(HttpSolrCall.java:517)
      	at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:380)
      	at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:326)
      	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1629)
      	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:533)
      	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.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
      	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:190)
      	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1595)
      	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:188)
      	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1253)
      	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:168)
      	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:473)
      	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1564)
      	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:166)
      	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1155)
      	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
      	at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:219)
      	at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:126)
      	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
      	at org.eclipse.jetty.rewrite.handler.RewriteHandler.handle(RewriteHandler.java:335)
      	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
      	at org.eclipse.jetty.server.Server.handle(Server.java:530)
      	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:347)
      	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:256)
      	at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:279)
      	at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:102)
      	at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:124)
      	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:247)
      	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.produce(EatWhatYouKill.java:140)
      	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:131)
      	at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:382)
      	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:708)
      	at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:626)
      	at java.lang.Thread.run(Thread.java:745)
      

      Since this is occurring because of missing parameter, Solr should return Bad Request

        Attachments

        1. SOLR-11883.patch
          9 kB
          Munendra S N
        2. SOLR-11883.patch
          5 kB
          Munendra S N
        3. SOLR-11883.patch
          4 kB
          Munendra S N
        4. SOLR-11883.patch
          3 kB
          Munendra S N

          Issue Links

            Activity

              People

              • Assignee:
                mkhl Mikhail Khludnev
                Reporter:
                munendrasn Munendra S N
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: