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

Frank Steggink commented on SOLR-10395:
---------------------------------------

@Matthias: here is an example request: 
http://geodata.nationaalgeoregister.nl/locatieserver/suggest?q=matenweg%20beuningen&indent=on
Currently I'm suppressing the error messages on this server (3 Solr instances, 
running in a Solr Cloud configuration, using external Zookeepers), but I can 
still reproduce it on a test server.

Here is the full configuration of the search handler:
{code:xml}
    <requestHandler name="/geosearch/suggest" class="solr.SearchHandler">
        <lst name="invariants">
            <str name="defType">llparser</str>
            <str name="mm">100%</str>
            <str name="fl">id,weergavenaam,type,score</str>
            <str name="df">suggest</str>
            <!-- Highlighting defaults -->
            <str name="hl">on</str>
            <str name="hl.fl">suggest</str>
            <str name="hl.fragsize">255</str>
            <str name="hl.encoder">html</str>
            <str name="hl.simple.pre">&lt;b&gt;</str>
            <str name="hl.simple.post">&lt;/b&gt;</str>
            <!-- Spell checking defaults -->
            <str name="spellcheck">on</str>
            <str name="spellcheck.dictionary">suggest</str>
            <str name="spellcheck.extendedResults">false</str>
            <str name="spellcheck.count">5</str>
            <str name="spellcheck.alternativeTermCount">2</str>
            <str name="spellcheck.maxResultsForSuggest">3</str>
            <str name="spellcheck.collate">true</str>
            <str name="spellcheck.collateExtendedResults">true</str>
            <str name="spellcheck.maxCollationTries">5</str>
            <str name="spellcheck.maxCollations">3</str>
        </lst>
        <lst name="defaults">
            <str name="wt">json</str>
            <str name="q.alt">*:*</str>
            <str name="rows">10</str>
            <str name="omitHeader">true</str>
            <!-- Boost exact matches -->
            <str name="qf">exacte_match^1 suggest^0.5 huisnummer^0.5 
huisletter^0.5 huisnummertoevoeging^0.5</str>
            <!-- Boost municipality above city above road above address -->
            <str name="bq">type:gemeente^1.5 type:woonplaats^1.5 type:weg^1.5 
type:postcode^0.5 type:adres^1</str>
            <!-- Sortering Politie was (invariant): typesortering asc, score 
desc, sortering asc, weergavenaam asc -->
            <str name="sort">score desc, sortering asc, weergavenaam asc</str>
        </lst>
        <!-- append spellchecking to our list of components -->
        <arr name="last-components">
            <str>spellcheck</str>
        </arr>
    </requestHandler>
{code}
We're using Solr as a geocoder. With this you can enter the name of an address, 
post code, street, city/village or municipality, and you get information about 
matching objects back. In this case one street, one postal code, and one 
address. This street has only one address, so I'm getting 3 results, triggering 
the collation, and also the exception.

Query parser:
{code:xml}
  <queryParser name="llparser" 
class="nl.kadaster.pdok.locatieserver.LatLonQueryParserPlugin"/>
{code}
The purpose of the LatLonQueryParser is to convert custom parameters lat and 
lon to parameters so Solr can execute a geospatial search. This class is based 
on the ExtendedDismaxQParser. I'm just setting these new parameters (sort, pt, 
boost, and distance) to the request. I'm also changing the private field config 
during reflection. I've written this QP already a few years ago, for a 
different client. I should probably have reported this before. All of this only 
happens when the lat and lon parameters have been given. But, as far as I know, 
I'm not doing anything related to spellchecking.

I'm not using any other plugins.


> NPE during spell check with result collation
> --------------------------------------------
>
>                 Key: SOLR-10395
>                 URL: https://issues.apache.org/jira/browse/SOLR-10395
>             Project: Solr
>          Issue Type: Bug
>      Security Level: Public(Default Security Level. Issues are Public) 
>          Components: spellchecker
>    Affects Versions: 6.2.1
>            Reporter: Frank Steggink
>
> I'm getting a NullPointerException when using collation during spell check. 
> This is the message I'm getting: Exception trying to re-query to check if a 
> spell check possibility would return any hits.
> Stack trace:
> {code}
> 2017-03-13 13:05:54.618 WARN (qtp472654579-84) [c:locatieserver s:dkk 
> r:core_node4 x:locatieserver_dkk_replica2] o.a.s.s.SpellCheckCollator 
> Exception trying to re-query to check if a spell check possibility would 
> return any hits.
> java.lang.NullPointerException
> at 
> org.apache.solr.spelling.SpellCheckCollator.collate(SpellCheckCollator.java:150)
> at 
> org.apache.solr.handler.component.SpellCheckComponent.addCollationsToResponse(SpellCheckComponent.java:297)
> at 
> org.apache.solr.handler.component.SpellCheckComponent.process(SpellCheckComponent.java:209)
> at 
> org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:295)
> at 
> org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:154)
> at org.apache.solr.core.SolrCore.execute(SolrCore.java:2089)
> ...
> {code}
> My spell check config for this search handler:
> {code:xml}
>             <str name="spellcheck">on</str>
>             <str name="spellcheck.dictionary">suggest</str>
>             <str name="spellcheck.extendedResults">false</str>
>             <str name="spellcheck.count">5</str>
>             <str name="spellcheck.alternativeTermCount">2</str>
>             <str name="spellcheck.maxResultsForSuggest">3</str>
>             <str name="spellcheck.collate">true</str>
>             <str name="spellcheck.collateExtendedResults">true</str>
>             <str name="spellcheck.maxCollationTries">5</str>
>             <str name="spellcheck.maxCollations">3</str>
> {code}
> The field "suggest" is a field in the index, which is also (usually) queried 
> with this search handler. The field is filled with lots of data created by 
> edge ngrams, since it's intended usage is for an autocomplete field.
> This issue is very similar to SOLR-8807, but the NPE is occurring one line in 
> the code later 
> (solr\core\src\java\org\apache\solr\spelling\SpellCheckCollator.java). As a 
> result the patch attached to that issue probably won't work in my case.
> {code:java}
>         try {
>           queryComponent.prepare(checkResponse);
>           if (docCollectionLimit > 0) {
>             int f = checkResponse.getFieldFlags();
>             checkResponse.setFieldFlags(f |= 
> SolrIndexSearcher.TERMINATE_EARLY);            
>           }
>           queryComponent.process(checkResponse);
>           hits = (Integer) checkResponse.rsp.getToLog().get("hits");
>         } catch (EarlyTerminatingCollectorException etce) {
> {code}
> Although I'm using Solr 6.2.1, the source file is still identical to Solr 
> 6.5.0.
> The line causing my exception is when determining the hits. I've noticed the 
> exception only occurs when no more than 2 alternatives are found, but when 3 
> alternatives (maxCollations) are found, the NPE isn't occurring.
> As a workaround I could live for now with turning collations off.
> Please let me know if you need more information. Thanks!



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

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to