blacklight icon indicating copy to clipboard operation
blacklight copied to clipboard

When spellcheck.collate is turned on, Blacklight should display collated "Did you mean" links

Open sandbergja opened this issue 7 years ago • 0 comments

The default "Did you mean" behavior in Blacklight is not helpful for users when their query contains multiple words (see #2028). If a user types in a 5-word query, for example, Blacklight will go ahead and suggest a correctly spelled one-word query instead. Expected behavior would be to offer the user a 5-word query with correct spelling.

Solr is capable of doing this, with spellcheck collation: https://lucene.apache.org/solr/guide/6_6/spell-checking.html#SpellChecking-Thespellcheck.collateParameter

But it looks like Blacklight doesn't pay any attention to the collations array in solr responses. Here's an excerpt of an example response from a solr query against the sample marc records:

"spellcheck":{
  "suggestions":[
    "strongh",{
      "numFound":3,
      "startOffset":2,
      "endOffset":9,
      "origFreq":0,
      "suggestion":[{
          "word":"strong",
          "freq":1},
        {
          "word":"sroṅ",
          "freq":1},
        {
          "word":"stran",
          "freq":1}]},
    "medicne",{
      "numFound":1,
      "startOffset":10,
      "endOffset":17,
      "origFreq":0,
      "suggestion":[{
          "word":"medicine",
          "freq":1}]}],
  "correctlySpelled":false,
  "collations":[
    "collation","*:strong medicine"]}}

It would be so nice if that "strong medicine" collation could be presented to the user, rather than the jumble of single-word suggestions.

sandbergja avatar Nov 08 '18 23:11 sandbergja