[
https://issues.apache.org/jira/browse/SOLR-1071?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Uri Boness updated SOLR-1071:
-----------------------------
Attachment: SpellCheckComponent_new_structure.patch
SpellCheckComponent_fix.patch
OK, so I checked it out and no, setting the {{json.nl}} parameter doesn't help
in this case. I looked it up and the problem lays in the fact that the
{{suggestions}} data structure is SimpleOrderedMap. SimpleOrderedMap structure
are always renderer by the JsonResponseWriter as a map and are not influenced
by the {{json.nl}} parameter. There are two possible solutions here as I see it:
1. A simple fix that would just replace the current SimpleOrderedMap with an
ordinary NamedList (see SpecllCheckComponent_fix.patch)
*Advantages:* More backward compatible
*Disadvantages:* you still need to use the {{json.nl}} parameter in order to
get it to work (and the this parameter influences the complete response
structure, not just the spellcheck output)
2. A small change to the response data structure that will put all the
suggestion items as an array value of one field named "suggestionItems" (see
SpellCheckComponent_new_structure.patch)
*Advantages:* A proper and intuitive structure for the response
*Disadvantages:* probably less backward compatible as the first solution
(NOTE: patches applied on the trunk version)
> 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: Grant Ingersoll
> Fix For: 1.3.1
>
> Attachments: SpellCheckComponent_fix.patch,
> SpellCheckComponent_new_structure.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.