lucene-solr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Uri Boness (JIRA)" <j...@apache.org>
Subject [jira] Commented: (SOLR-1071) spellcheck.extendedResults returns an invalid JSON response when count > 1
Date Tue, 08 Sep 2009 09:58:57 GMT

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

Uri Boness commented on SOLR-1071:
----------------------------------

Looks good! 

As for the naming, I really like your suggestion (in one of the comments above) to replace
"suggestion" with "alternatives". So the client code can look something like:

{code}
response.getSuggestions().get("hell").getAlternatives().get(0);
{code}

One more thing - I think it will be more intuitive to use a SimpleOrderedMap instead of a
NamedList for the "suggestions" node. for the xml response it won't make much difference I
guess, but for the json one it will be more intuitive and easier to work with. So to take
your example above, you'd get something like:

{code}
"spellcheck": {
    "suggestions": {
        "hell":{
            "numFound":2,
            "startOffset":0,
            "endOffset":4,
            "origFreq":0,
            "alternatives":[
                {
                    "word":"dell",
                    "freq":4
                },
                {
                    "word":"all",
                    "freq":4
                }
            ]
        },
        "correctlySpelled":false}}}
{code}



> spellcheck.extendedResults returns an invalid JSON response when count > 1
> --------------------------------------------------------------------------
>
>                 Key: SOLR-1071
>                 URL: https://issues.apache.org/jira/browse/SOLR-1071
>             Project: Solr
>          Issue Type: Bug
>          Components: spellchecker
>    Affects Versions: 1.3
>            Reporter: Uri Boness
>            Assignee: Yonik Seeley
>             Fix For: 1.4
>
>         Attachments: SOLR-1071.patch, SpellCheckComponent_fix.patch, SpellCheckComponent_new_structure.patch,
SpellCheckComponent_new_structure_incl_test.patch
>
>
> When: wt=json & spellcheck.extendedResults=true & spellcheck.count > 1, the
suggestions are returned in the following format:
> "suggestions":[
> 	"amsterdm",{
> 	 "numFound":5,
> 	 "startOffset":0,
> 	 "endOffset":8,
> 	 "origFreq":0,
> 	 "suggestion":{
> 	  "frequency":8498,
> 	  "word":"amsterdam"},
> 	 "suggestion":{
> 	  "frequency":1,
> 	  "word":"amsterd"},
> 	 "suggestion":{
> 	  "frequency":8,
> 	  "word":"amsterdams"},
> 	 "suggestion":{
> 	  "frequency":1,
> 	  "word":"amstedam"},
> 	 "suggestion":{
> 	  "frequency":22,
> 	  "word":"amsterdamse"}},
> 	"beak",{
> 	 "numFound":5,
> 	 "startOffset":9,
> 	 "endOffset":13,
> 	 "origFreq":0,
> 	 "suggestion":{
> 	  "frequency":379,
> 	  "word":"beek"},
> 	 "suggestion":{
> 	  "frequency":26,
> 	  "word":"beau"},
> 	 "suggestion":{
> 	  "frequency":26,
> 	  "word":"baak"},
> 	 "suggestion":{
> 	  "frequency":15,
> 	  "word":"teak"},
> 	 "suggestion":{
> 	  "frequency":11,
> 	  "word":"beuk"}},
> 	"correctlySpelled",false,
> 	"collation","amsterdam beek"]}}
> This is an invalid json as each term is associated with a JSON object which holds multiple
"suggestion" attributes. When working with a JSON library only the last "suggestion" attribute
is picked up.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message