.net - Solr 对包含多个单词的短语进行拼写检查
问题描述
如果“heritga festiavl”作为一个句子进行搜索,那么预期结果应该是“heritage Festival”或“heritag festi”,但建议是针对每个单词单独给出的。是否可以将建议作为单个短语获得。如果为单词添加准确性,则会清楚地给出建议,但准确性会因单词而异。例如,如果准确度 0.86 适用于 word Heritage 以显示结果,但相同的准确度不适用于 word heart。需要有意义的建议。
我得到的示例结果建议:
{
"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": []
}
}
解决方案
关于短语的需要,您可以尝试按照文档spellcheck.collate
中的说明设置为。true
推荐阅读
- c - 输入允许的最大字符串数时,如何在创建字符串数组时跳出循环?
- python - 如何根据列名、另一列中的值和索引范围替换数据框中列中的值?
- symfony - Symfony - 无法确定从哪里加载数据库配置
- html - 为不同的html站点更改CSS中的文本颜色?
- java - Gradle 同步错误:SSL 对等方错误关闭
- r - RShiny shinyalert 回调不更新变量?
- c# - Linq to XML - 获取属性和元素
- bash - 如何在 Windows 的 Bash 终端中显示我的活动 Git 分支?
- javascript - 移动设备的最佳实践 api 调用
- node.js - 为什么mysql查询显示ColumnDefinition