Grant Ingersoll wrote:

On Jun 26, 2008, at 5:25 PM, Geoffrey Young wrote:



well *almost* - it works most excellently with q=$term but when I add
spellchecker.q=$term things implode:

HTTP Status 500 - null java.lang.NullPointerException at
org
.apache
.solr
.handler
.component.SpellCheckComponent.getTokens(SpellCheckComponent.java:215) at
org.apache.solr.handler.component.SpellCheckComponent.process(SpellCheckComponent.java:183) at org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:156) at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:125) at org.apache.solr.core.SolrCore.execute(SolrCore.java:965) at org.apache.solr.servlet.SolrDispatchFilter.execute(SolrDispatchFilter.java:338) at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:272) at...

not being a java guy I need to use solr out of the box, and adding
spellchecker.q makes my multi-word terms checked at the phrase level
("mickey mouse") instead of at the word level ("mickey" "mouse") which is the behavior I'm seeking. the docs make it sound like I could write my own
SpellingQueryConverter, but... well, they also use both q and
spellchecker.q at the same time, so it shouldn't implode like that :)


What's your <searchComponent> look like for the SpellCheckComponent, exactly?

sorry for the long post - first some trivial stuff...

I had null pointer exceptions left and right while composing this email... then I added spellcheck.build=true to one and they went away. do you need to rebuild the spelling index every time you alter (certain parts) of solrconfig.xml? it was very consistent as reported below, but after simply issuing a rebuild I can't reproduce the null pointer.

my original problem was...

request to

/solr/select?q=celin+dion&qf=search-en&qt=Search::Model::JSON::Search::Scan&spellcheck=true&indent=on&&echoParams=all

succeeds as

{
 "responseHeader":{
  "status":0,
  "QTime":9,
  "params":{
        "fq":"Type:Event OR Type:Attraction OR Type:Venue",
        "echoParams":"all",
        "indent":"on",
        "qf":"search-en",
        "defType":"dismax",
        "spellcheck":"true",
        "echoParams":"all",
        "indent":"on",
        "q":"celin dion",
        "qf":"search-en",
        "qt":"Search::Model::JSON::Search::Scan",
        "mm":"100%",
        "facet":"false",
        "start":"0",
        "wt":"json",
        "rows":"0"}},
 "response":{"numFound":59,"start":0,"docs":[]
 },
 "spellcheck":{
  "suggestions":[
        "celin",[
         "numFound",1,
         "startOffset",0,
         "endOffset",5,
         "suggestion",["celina"]]]}}

request to

/solr/select?q=celin+dion&qf=search-en&qt=Search::Model::JSON::Search::Scan&spellcheck=true&indent=on&&echoParams=all&spellcheck.q=celin+dion

implodes with

null java.lang.NullPointerException at org.apache.solr.handler.component.SpellCheckComponent.getTokens(SpellCheckComponent.java:215) at...

if it makes a difference, it's svn trunk from last night + SOLR-14 applied.

thanks for taking the time - I'm hoping this isn't now a wild goose chase :)

--Geoff

solrconfix.xml

<requestHandler name="Search::Model::JSON::Search::Scan" class="solr.DisMaxRequestHandler" >
    <lst name="defaults">
      <str name="echoParams">none</str>
      <str name="indent">off</str>
      <str name="qf">search sAttractionName sVenueName</str>
    </lst>
    <lst name="invariants">
      <str name="mm">100%</str>
      <str name="wt">json</str>
      <int name="start">0</int>
      <int name="rows">0</int>
      <str name="facet">false</str>
    </lst>
    <lst name="appends">
      <str name="fq">Type:Event OR Type:Attraction OR Type:Venue</str>
    </lst>
    <arr name="last-components">
      <str>spellcheck</str>
    </arr>
  </requestHandler>

<searchComponent name="spellcheck" class="org.apache.solr.handler.component.SpellCheckComponent">
    <lst name="defaults">
      <str name="spellcheck.onlyMorePopular">false</str>
      <str name="spellcheck.extendedResults">false</str>
    </lst>
    <lst name="invariants">
      <str name="spellcheck.count">5</str>
    </lst>
    <str name="queryAnalyzerFieldType">spell</str>

    <lst name="spellchecker">
      <str name="name">default</str>
      <str name="field">spell</str>
      <str name="spellcheckIndexDir">defaultspell</str>
    </lst>
  </searchComponent>

<queryConverter name="queryConverter" class="org.apache.solr.spelling.SpellingQueryConverter"/>

schema.xml:

<fieldType name="spell" class="solr.TextField" positionIncrementGap="100">
      <analyzer type="index">
        <tokenizer class="solr.KeywordTokenizerFactory"/>
        <filter class="solr.LowerCaseFilterFactory"/>
      </analyzer>
      <analyzer type="query">
        <tokenizer class="solr.KeywordTokenizerFactory"/>
        <filter class="solr.LowerCaseFilterFactory"/>
      </analyzer>
    </fieldType>

Reply via email to