对包含多个单词的短语进行Solr拼写检查

rqcrx0a6  于 2022-11-05  发布在  Solr
关注(0)|答案(1)|浏览(124)

如果“heritga festiavl”作为一个句子被搜索,那么预期的结果应该是“传统节日”或“传统节日”,但建议是为每个单词单独给出的。是否可以作为单个短语获得建议。如果为单词添加了准确性,建议会清楚地给出,但准确性会根据单词而变化。例如,如果准确性为0。86对单词遗产显示结果起作用,但同样的准确性对单词心脏不起作用。需要有意义的建议。

我得到的示例结果建议:

{
  "responseHeader": {
    "status": 0,
    "QTime": 37
  },
  "command": "build",
  "response": {
    "numFound": 0,
    "start": 0,
    "docs": []
  },
  "spellcheck": {
    "suggestions": [
      "heritg",
      {
        "numFound": 10,
        "startOffset": 0,
        "endOffset": 7,
        "origFreq": 0,
        "suggestion": [
          {
            "word": "herita",
            "freq": 7
          },
          {
            "word": "heritag",
            "freq": 7
          },
          {
            "word": "herit",
            "freq": 7
          },
          {
            "word": "heritage",
            "freq": 7
          },
          {
            "word": "hearing",
            "freq": 6
          },
          {
            "word": "hiring",
            "freq": 5
          },
          {
            "word": "hertz",
            "freq": 1
          },
          {
            "word": "heig",
            "freq": 12
          },
          {
            "word": "heri",
            "freq": 7
          },
          {
            "word": "hert",
            "freq": 1
          }
        ]
      },
      "heritga",
      {
        "numFound": 4,
        "startOffset": 0,
        "endOffset": 7,
        "origFreq": 0,
        "suggestion": [
          {
            "word": "heritag",
            "freq": 7
          },
          {
            "word": "herita",
            "freq": 7
          },
          {
            "word": "heritage",
            "freq": 7
          },
          {
            "word": "herit",
            "freq": 7
          }
        ]
      },
      "festia",
      {
        "numFound": 5,
        "startOffset": 8,
        "endOffset": 16,
        "origFreq": 0,
        "suggestion": [
          {
            "word": "festiv",
            "freq": 14
          },
          {
            "word": "festiva",
            "freq": 14
          },
          {
            "word": "festi",
            "freq": 14
          },
          {
            "word": "festival",
            "freq": 14
          },
          {
            "word": "fest",
            "freq": 14
          }
        ]
      },
      "festiav",
      {
        "numFound": 4,
        "startOffset": 8,
        "endOffset": 16,
        "origFreq": 0,
        "suggestion": [
          {
            "word": "festiva",
            "freq": 14
          },
          {
            "word": "festiv",
            "freq": 14
          },
          {
            "word": "festival",
            "freq": 14
          },
          {
            "word": "festi",
            "freq": 14
          }
        ]
      },
      "festiavl",
      {
        "numFound": 3,
        "startOffset": 8,
        "endOffset": 16,
        "origFreq": 0,
        "suggestion": [
          {
            "word": "festival",
            "freq": 14
          },
          {
            "word": "festiva",
            "freq": 14
          },
          {
            "word": "festiv",
            "freq": 14
          }
        ]
      }
    ],
    "correctlySpelled": false,
    "collations": []
  }
}
6mzjoqzu

6mzjoqzu1#

关于短语的需要,您可以尝试将spellcheck.collate设置为true,如documentation中所述。

相关问题