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

Hoss Man commented on SOLR-9104:
--------------------------------

I haven't dug into this much, but here is line 814 in 6.0.0...

{code}
int nextDocBase = currentContext+1 < contexts.length ? 
contexts[currentContext+1].docBase : maxDoc;
{code}

* currentContext is a primitive int that's set to 0, so it can't be the NPE
* contexts must be non-null or we would have gotten an NPE earlier in this 
method
* that leaves {{contexts\[currentContext+1\]}} as the only possible source of 
the NPE.

So at a glance, my best guess for what's happening here is that:

* you have multiple secments and CollapsingQParserPlugin initializes 
{{contexts[]}} accordnly
* doSetNextReader is, apparently, *NOT* getting called for every segment
* because doSetNextReader is not called for some segments, {{contexts\[x\]}} is 
null for some values of x, and code in the {{finish()}} method does not expect 
any null values in {{contexts[]}}

Based on your statement that you can reproduce this only when there are zero 
results and when using multiple collapse components, my guess is: with multiple 
DelegatingCollectors in a chain, if one collector doesn't match anything in 
segementX then doSetNextReader(segmentX) isn't getting called on all the 
subsequent collectors.

Off the top of my head, i don't know if that means there is a bug in the the 
code that *calls* DelegatingCollectors, or if the bug is in 
CollapsingQParserPlugin for *assuing* doSetNextReader will aways be called? ... 
IIRC CollapsingQParserPlugin plays fast an loose with the normal contracts, 
defering a lot of stuff that's normally done in {{collect(..)}} until the 
finish method ... maybe it's not doing what it needs to do to delegate properly 
to other nstances of itself when a segment matches no docs?

----

In any case, hopefully that gives you enough info to try and create a 
reproducible/debugable test case?  an index with mutiple segments where some 
segments match no docs in the query and multiple collapse fqs are used?




> NPE in CollapsingQParser when two fq={!collapse} and zero results
> -----------------------------------------------------------------
>
>                 Key: SOLR-9104
>                 URL: https://issues.apache.org/jira/browse/SOLR-9104
>             Project: Solr
>          Issue Type: Bug
>    Affects Versions: 6.0
>            Reporter: Markus Jelsma
>             Fix For: 6.1, master (7.0)
>
>
> This is a very weird problem that is reproducible on a small production 
> server, but not on the local machine although they run the same 6.0 version., 
> and have an almost identical index. The only minor difference is that 
> production is a SolrCloud with 1 shard and two replica's, just for a bit of 
> redundancy.
> The following query yields zero results and throws the NPE:
> {code}
> select?q=query:seis&fq={!collapse field=query_digest}&fq={!collapse 
> field=result_digest}
> {code}
> The next query does yield results and does not throw anything, it just works 
> as it should work:
> {code}
> select?q=query:seiz&fq={!collapse field=query_digest}&fq={!collapse 
> field=result_digest}
> {code}
> The /select handler used does not add any fancy param other than rows.
> Here's the NPE:
> {code}
> 2016-05-11 14:10:27.666 ERROR (qtp1209271652-3338) [c:suggestions s:shard1 
> r:core_node1 x:suggestions_shard1_replica1] o.a.s.s.HttpSolrCall 
> null:java.lang.NullPointerException
>         at 
> org.apache.solr.search.CollapsingQParserPlugin$IntScoreCollector.finish(CollapsingQParserPlugin.java:814)
>         at 
> org.apache.solr.search.CollapsingQParserPlugin$IntScoreCollector.finish(CollapsingQParserPlugin.java:851)
>         at 
> org.apache.solr.search.SolrIndexSearcher.buildAndRunCollectorChain(SolrIndexSearcher.java:272)
>         at 
> org.apache.solr.search.SolrIndexSearcher.getDocListNC(SolrIndexSearcher.java:1794)
>         at 
> org.apache.solr.search.SolrIndexSearcher.getDocListC(SolrIndexSearcher.java:1611)
>         at 
> org.apache.solr.search.SolrIndexSearcher.search(SolrIndexSearcher.java:634)
>         at 
> org.apache.solr.handler.component.QueryComponent.process(QueryComponent.java:529)
>         at 
> org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:287)
>         at 
> org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:155)
> {code}
> Edit: for the sake of clarity. It really needs double fq={!collapse bla bla 
> for the NPE to appear. If i remove either of the filters from the query, i 
> get a nice zero resultset back. Both fields are defined as int.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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

Reply via email to