Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Lucene: ruby-dev

ruby/json response for spellcheck component

 

 

Lucene ruby-dev RSS feed   Index | Next | Previous | View Threaded


goodieboy at gmail

Oct 14, 2008, 10:36 AM

Post #1 of 1 (3189 views)
Permalink
ruby/json response for spellcheck component

Hi,

I'm working on a patch to support the new SpellCheckComponent in solr-ruby.
I see that the response in some cases has duplicate keys. Here is an
example:

'suggestions'=>[

'buk',{'numFound'=>5,'startOffset'=>0,'endOffset'=>3,'origFreq'=>0,'suggestion'=>{'frequency'=>27,'word'=>'bul'},'suggestion'=>{'frequency'=>5,'word'=>'bus'},'suggestion'=>{'frequency'=>3,'word'=>'bok'},'suggestion'=>{'frequency'=>3,'word'=>'buy'},'suggestion'=>{'frequency'=>2,'word'=>'bulk'}},

'bot',{'numFound'=>5,'startOffset'=>4,'endOffset'=>7,'origFreq'=>1,'suggestion'=>{'frequency'=>57,'word'=>'box'},'suggestion'=>{'frequency'=>20,'word'=>'tot'},'suggestion'=>{'frequency'=>20,'word'=>'both'},'suggestion'=>{'frequency'=>18,'word'=>'boy'},'suggestion'=>{'frequency'=>7,'word'=>'mot'}},
'correctlySpelled',false,
'collation','bul box'
]

When this is eval'd in Ruby, only the last instance of a duplicate key
(suggestion) makes it (maybe I'm completely missing something though) - Was
this the desired format and if so, anyone have any ideas on how to handle
this sort of thing? I'd vote for changing 'suggestion'=>{} to
'suggestions'=>[{},{}] etc..

Also, a possible gotcha for this format is... what if one of your terms was
'suggestion' or 'collation'? The spellcheck response fields are mixed right
in with the terms. What about having a separate key called 'terms':

'suggestions'=>[
'collation', 'bul box',
'correctlySpelled',false,
'terms',[
'buk', {'numFound'=>5, 'suggestions'=>[{},{}]},
'bot', {'numFound'=>5m 'suggestions'=>[{},{}]}
]
]

etc..

Matt

Lucene ruby-dev RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.