Skip to content
This repository was archived by the owner on Jun 1, 2021. It is now read-only.
This repository was archived by the owner on Jun 1, 2021. It is now read-only.

NPE in SuggestionResultFactory on multi word suggestions #107

@westei

Description

@westei

observed on: 2.1.3

A pretty default configuration:

FieldType:

    <fieldType name="text_suggest" class="solr.TextField" positionIncrementGap="100">
      <analyzer>
        <tokenizer class="solr.ClassicTokenizerFactory"/>
        <filter class="solr.LowerCaseFilterFactory"/>
      </analyzer>
    </fieldType>

Field: <field name="suggestions" type="text_suggest" indexed="true" stored="false" multiValued="true"/>

The field is filled with some copyField statements including titles, keywords, location names.

Note that some of the copied field use a special key

RequestHandler and InitParams

<requestHandler name="/suggester" class="com.rbmhtechnology.vind.solr.suggestion.SuggestionRequestHandler">
        <lst name="appends">
           <!-- two fq so that only published Items are included -->
            <str name="fq">published:true</str>
            <str name="fq">{!field f=published_range op=Contains}NOW</str>
        </lst>
    </requestHandler>
    <initParams path="/suggester">
      <lst name="defaults">
          <str name="echoParams">explicit</str>
          <str name="suggestion">true</str>
          <!-- the suggestion.fields with copyField configs in the schema.xml -->
          <str name="suggestion.field">[..]</str>
          <str name="suggestion.df">suggestions</str>
          <str name="suggestion.term.limit">10</str>
          <str name="spellcheck.accuracy">0.75</str>
      </lst>
      <arr name="first-components">
          <str>spellcheck</str>
      </arr>
    </initParams> 

Suggestions for a single word work fine, but as soon as the query includes multiple words like suggester?q=Excel%20Po the SuggestionResultFactory throws NPE.

java.lang.NullPointerException\n\tat com.rbmhtechnology.vind.solr.suggestion.result.SuggestionResultFactory.createSingleValueResult(SuggestionResultFactory.java:119)
	at com.rbmhtechnology.vind.solr.suggestion.service.SuggestionService.createResults(SuggestionService.java:154)
	at com.rbmhtechnology.vind.solr.suggestion.service.SuggestionService.getSuggestionResults(SuggestionService.java:121)
	at com.rbmhtechnology.vind.solr.suggestion.service.SuggestionService.run(SuggestionService.java:89)
	at com.rbmhtechnology.vind.solr.suggestion.SuggestionRequestHandler.handleRequestBody(SuggestionRequestHandler.java:246)
	at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:199)
	at org.apache.solr.core.SolrCore.execute(SolrCore.java:2551)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions