You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Doug Macdonald <do...@usask.ca> on 2008/10/08 20:50:44 UTC

Spellchecker extended results problem

Hi,

I'm having trouble with the spell check component of Solr 1.3.  If I 
request multiple extended results from spell check with a json result 
format,  the results get decoded into a single 'suggestion' array.

For example, for the query

http://localhost:8983/solr/spellCheckCompRH?q=beaar&spellcheck.q=beaar&spellcheck=true&spellcheck.extendedResults=true&spellcheck.count=3&wt=json

I get back

"spellcheck":{
  "suggestions":
    ["beaar", {
      "numFound":3,
      "startOffset":0,
      "endOffset":5,
      "origFreq":0,
      "suggestion":{
        "frequency":168,"word":"bear"
      },
      "suggestion":{
        "frequency":29,"word":"beaver"
      },
      "suggestion":{
        "frequency":10,"word":"bears"
      }
    },
    "correctlySpelled",false]
}



which decodes into (using json_decode of PHP 5)

   [spellcheck] => stdClass Object
        (
            [suggestions] => stdClass Object
                (
                    [beaar] => stdClass Object
                        (
                            [numFound] => 10
                            [startOffset] => 0
                            [endOffset] => 5
                            [origFreq] => 0
                            [suggestion] => stdClass Object
                                (
                                    [frequency] => 10
                                    [word] => bears
                                )
                        )
                    [correctlySpelled] => 
                )
        )

so it's only giving me the last term from the suggestion list. Does anyone know how to get around this (without changing the return format from json)? 


thanks,

Doug Macdonald
University of Saskatchewan Library