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

Matthias Krueger commented on SOLR-8807:
----------------------------------------

My client is affected by this NPE, too. Some oddities of the SpellCheckCollator 
seem to misalign with behaviour of the CollapsingQParserPlugin's collectors.
* The {{checkResponse}} ResponseBuilder in SpellCheckCollator#collate is being 
built using the original params (including the fq=\{!collapse…\} param) *and* 
the original filters.
* The {{checkResponse}} ends up having the 
CollapsingQParserPlugin$CollapsingPostFilter twice in the {{filters}} list.
* They will end up in a DelegatingCollector chain 
CollapsingQParserPlugin$OrdScoreCollector -> 
CollapsingQParserPlugin$OrdScoreCollector.
* Unfortunately, this does not work well when there are documents returned from 
less than all segments. The two OrdScoreCollectors are instantiated with the 
number of segments and open an empty array of LeafReaderContexts but their 
values are only populated for the first OrdScoreCollector in 
IndexSearcher#search (via Collector#getLeafCollector -> 
OrdScoreCollector#doSetNextReader) calls.
* OrdScoreCollector (and the other collectors in CollapsingQParserPlugin) only 
passes the LeafReaderContexts to the delegate within finish() (not within 
#doSetNextReader) but stops when it deems all necessary segments consumed. When 
the delegate itself then performs the iteration it will NPE in
{code}
nextDocBase = currentContext+1 < contexts.length ? 
contexts[currentContext+1].docBase : maxDoc;
{code}


> NPE during spell checking when result collapsing is activated and index got 
> more than one segment.
> --------------------------------------------------------------------------------------------------
>
>                 Key: SOLR-8807
>                 URL: https://issues.apache.org/jira/browse/SOLR-8807
>             Project: Solr
>          Issue Type: Bug
>          Components: spellchecker
>    Affects Versions: 5.4
>         Environment: Solr 5.4 with an index cosisting of two segments
>            Reporter: Christian Danninger
>            Priority: Critical
>              Labels: collapse, spellcheck
>
> When using spellchecker with collapse/expand results, I got an NPE. Only 
> happend when the index consists of more than one segment. 
> {code}
> 11:30:33,505 WARN  [org.apache.solr.spelling.SpellCheckCollator] 
> (http-/0.0.0.0:8080-2) Exception trying to re-query to check if a spell check 
> possibility would return any hits.: java.lang.NullPointerException
>         at 
> org.apache.solr.search.CollapsingQParserPlugin$OrdScoreCollector.finish(CollapsingQParserPlugin.java:631)
>  [solr-core-5.4.0.jar:5.4.0 1718046 - upayavira - 2015-12-04 23:16:46]
>         at 
> org.apache.solr.search.CollapsingQParserPlugin$OrdScoreCollector.finish(CollapsingQParserPlugin.java:681)
>  [solr-core-5.4.0.jar:5.4.0 1718046 - upayavira - 2015-12-04 23:16:46]
>         at 
> org.apache.solr.search.SolrIndexSearcher.buildAndRunCollectorChain(SolrIndexSearcher.java:213)
>  [solr-core-5.4.0.jar:5.4.0 1718046 - upayavira - 2015-12-04 23:16:46]
>         at 
> org.apache.solr.search.SolrIndexSearcher.getDocListNC(SolrIndexSearcher.java:1672)
>  [solr-core-5.4.0.jar:5.4.0 1718046 - upayavira - 2015-12-04 23:16:46]
>         at 
> org.apache.solr.search.SolrIndexSearcher.getDocListC(SolrIndexSearcher.java:1491)
>  [solr-core-5.4.0.jar:5.4.0 1718046 - upayavira - 2015-12-04 23:16:46]
>         at 
> org.apache.solr.search.SolrIndexSearcher.search(SolrIndexSearcher.java:557) 
> [solr-core-5.4.0.jar:5.4.0 1718046 - upayavira - 2015-12-04 23:16:46]
>         at 
> org.apache.solr.handler.component.QueryComponent.process(QueryComponent.java:525)
>  [solr-core-5.4.0.jar:5.4.0 1718046 - upayavira - 2015-12-04 23:16:46]
>         at 
> org.apache.solr.spelling.SpellCheckCollator.collate(SpellCheckCollator.java:147)
>  [solr-core-5.4.0.jar:5.4.0 1718046 - upayavira - 2015-12-04 23:16:46]
>         at 
> org.apache.solr.handler.component.SpellCheckComponent.addCollationsToResponse(SpellCheckComponent.java:238)
>  [solr-core-5.4.0.jar:5.4.0 1718046 - upayavira - 2015-12-04 23:16:46]
>         at 
> org.apache.solr.handler.component.SpellCheckComponent.process(SpellCheckComponent.java:203)
>  [solr-core-5.4.0.jar:5.4.0 1718046 - upayavira - 2015-12-04 23:16:46]
>         at 
> org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:281)
>  [solr-core-5.4.0.jar:5.4.0 1718046 - upayavira - 2015-12-04 23:16:46]
>         at 
> org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:156)
>  [solr-core-5.4.0.jar:5.4.0 1718046 - upayavira - 2015-12-04 23:16:46]
>         at org.apache.solr.core.SolrCore.execute(SolrCore.java:2073) 
> [solr-core-5.4.0.jar:5.4.0 1718046 - upayavira - 2015-12-04 23:16:46]
> {code}
> {code}
>   <requestHandler name="/select" class="solr.SearchHandler">
>       <arr name="last-components">
>         <str>spellchecker</str>
>       </arr>    
>     </requestHandler>
> {code}
> The query parameters are:
> {code}
>       "spellcheck.maxCollations": "5",
>       "q.op": "AND",
>       "fq": "{!collapse field=type}",
>       "spellcheck.maxCollationTries": "10",
>       "spellcheck.collateMaxCollectDocs": "100000",
>       "spellcheck.alternativeTermCount": "10",
>       "spellcheck.extendedResults": "true",
>       "spellcheck.dictionary": [
>         "dest_wordbreak",
>         "dest_fuzzy"
>       ],
>       "q": "kosamui thailand",
>       "defType": "edismax",
>       "expand": "true",
>       "spellcheck.maxResultsForSuggest": "3",
>       "qf": "country_name region_name",
>       "spellcheck": "true",
>       "spellcheck.accuracy": "0.5",
>       "spellcheck.count": "20",
>       "spellcheck.collate": "true",
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

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

Reply via email to