I posted this to the solr-user and got no love. I’m hoping somebody here might 
be able to help me.

 

I’m using solr 6.5.0, which is fantastic, and I’ve come across an issue with 
the collations in the spellcheck response. 

 

The way the json is structured collations is an object with each collation 
named ‘collation’ where it should be an array with multiple ‘collation’ object 
elements. I’m using the ajax solr javascript library and because of the above 
each successive collation object writes over the previous, leaving the last and 
least likely collation.

 

I dug a little deeper and I noticed what I think is an error in 
org.apache.solr.handler.component.SpellCheckComponent.java. The collationList 
is a SimpleOrderedMap which requires a unique key for each entry to work 
correctly. But, each collation is added with the key “collation”. As I see it, 
there are two possible solutions:

1.       Change the collationsList type to an ArrayList and ignore the key, or

2.       Append a numeric value to the key so they become “collation0”, 
“collation1”, etc

 

I’d just like to know I’m not going nuts and the issue really exists.

 

Below is the snippet of response json relevant to this issue, notice collations 
contains multiple collation objects using the same key (collation):

 

"collations":{

      "collation":{

        "collationQuery":"haemorrhagic broken",

        "hits":36,

        "misspellingsAndCorrections":[

          "hemorrhagic","haemorrhagic",

          "braken","broken"]},

      "collation":{

        "collationQuery":"haemorrhagic brake",

        "hits":22,

        "misspellingsAndCorrections":[

          "hemorrhagic","haemorrhagic",

          "braken","brake"]},

      "collation":{

        "collationQuery":"hemorrhage broken",

        "hits":16,

        "misspellingsAndCorrections":[

          "hemorrhagic","hemorrhage",

          "braken","broken"]},

      "collation":{

        "collationQuery":"haemorrhagic braces",

        "hits":23,

        "misspellingsAndCorrections":[

          "hemorrhagic","haemorrhagic",

          "braken","braces"]},

      "collation":{

        "collationQuery":"hemorrhage brake",

        "hits":2,

        "misspellingsAndCorrections":[

          "hemorrhagic","hemorrhage",

          "braken","brake"]}

         }

     }

 

I’d appreciate any pointers with this. 

 

 

 

Z.

 

Reply via email to