我想在上传一些初始数据(在Solr 5.3.1中)后更新Solr建议词典。 在删除所有数据并上传修改后的数据后,更新建议词典。 但是,当我删除任何特定的记录(例如id = 123)时,建议者仍然返回结果集中已删除的记录。
例如,
我最初将以下json数据上传到mycollection:json_data.json
[ { "id": 1, "name": "New York" }, { "id": 2, "name": "New Jersey" }, { "id": 3, "name": "California" } ]用这个命令:
curl -X POST -H 'Content-Type: application/json' 'http://localhost:8983/solr/mycollection/update?commit=true' --data-binary @json_data.json 选择查询返回以下内容:localhost:8983 / solr / mycollection / select?q = %3A &wt = json&indent = true
{ "responseHeader": { "status": 0, "QTime": 0, "params": { "q": "*:*", "indent": "true", "wt": "json", "_": "1448271522315" } }, "response": { "numFound": 3, "start": 0, "docs": [ { "id": "1", "name": [ "New York" ], "_version_": 1518622755181822000 }, { "id": "2", "name": [ "New Jersey" ], "_version_": 1518622755186016300 }, { "id": "3", "name": [ "California" ], "_version_": 1518622755187064800 } ] } } 建议器为“新”字返回以下内容:本地主机:8983 / Solr的/ MyCollection的/建议Q =最新及重量= JSON和缩进=真的吗?
{ "responseHeader": { "status": 0, "QTime": 0 }, "spellcheck": { "suggestions": [ "New", { "numFound": 2, "startOffset": 0, "endOffset": 3, "suggestion": [ "New Jersey", "New York" ] } ], "collations": [ "collation", "(New Jersey)" ] } }现在我使用以下命令从mycollection中删除“New Jersey”:curl http:// localhost:8983 / solr / mycollection / update?commit = true -H“Content-Type:text / xml”--data-binary'(id :2)”
现在选择查询只返回剩余的2条记录(已删除“新泽西州”)
localhost:8983 / solr / mycollection / select?q = %3A &wt = json&indent = true
{ "responseHeader": { "status": 0, "QTime": 0, "params": { "q": "*:*", "indent": "true", "wt": "json", "_": "1448272061874" } }, "response": { "numFound": 2, "start": 0, "docs": [ { "id": "1", "name": [ "New York" ], "_version_": 1518622755181822000 }, { "id": "3", "name": [ "California" ], "_version_": 1518622755187064800 } ] } } 但建议查询仍然返回结果集中的“新泽西州”本地主机:8983 / Solr的/ MyCollection的/建议Q =最新及重量= JSON和缩进=真的吗?
{ "responseHeader": { "status": 0, "QTime": 0 }, "spellcheck": { "suggestions": [ "New", { "numFound": 2, "startOffset": 0, "endOffset": 3, "suggestion": [ "New Jersey", "New York" ] } ], "collations": [ "collation", "(New Jersey)" ] } }重新加载管理核心并重新启动solr服务器后,我尝试过,但结果保持不变。
可能是什么问题? 有什么建议者组件(solr.SpellCheckComponent)使用缓存? 如果是的话,该如何清理?
任何帮助,将不胜感激。
I want to update Solr suggester dictionary after uploading some initial data (in Solr 5.3.1). The suggester dictionary is updated after deleting all data and uploading the modified data back. But when I delete any particular record (eg. id=123), the suggester still returns the deleted record in result set.
For example,
I upload following json data initially to mycollection:json_data.json
[ { "id": 1, "name": "New York" }, { "id": 2, "name": "New Jersey" }, { "id": 3, "name": "California" } ]with this command:
curl -X POST -H 'Content-Type: application/json' 'http://localhost:8983/solr/mycollection/update?commit=true' --data-binary @json_data.json Select query returns the following:localhost:8983/solr/mycollection/select?q=%3A&wt=json&indent=true
{ "responseHeader": { "status": 0, "QTime": 0, "params": { "q": "*:*", "indent": "true", "wt": "json", "_": "1448271522315" } }, "response": { "numFound": 3, "start": 0, "docs": [ { "id": "1", "name": [ "New York" ], "_version_": 1518622755181822000 }, { "id": "2", "name": [ "New Jersey" ], "_version_": 1518622755186016300 }, { "id": "3", "name": [ "California" ], "_version_": 1518622755187064800 } ] } } Suggester returns the following for "New" word:localhost:8983/solr/mycollection/suggest?q=New&wt=json&indent=true
{ "responseHeader": { "status": 0, "QTime": 0 }, "spellcheck": { "suggestions": [ "New", { "numFound": 2, "startOffset": 0, "endOffset": 3, "suggestion": [ "New Jersey", "New York" ] } ], "collations": [ "collation", "(New Jersey)" ] } }Now I delete "New Jersey" from mycollection with following command: curl http://localhost:8983/solr/mycollection/update?commit=true -H "Content-Type: text/xml" --data-binary '(id:2)'
Now select query returns only the remaining 2 records (removed "New Jersey")
localhost:8983/solr/mycollection/select?q=%3A&wt=json&indent=true
{ "responseHeader": { "status": 0, "QTime": 0, "params": { "q": "*:*", "indent": "true", "wt": "json", "_": "1448272061874" } }, "response": { "numFound": 2, "start": 0, "docs": [ { "id": "1", "name": [ "New York" ], "_version_": 1518622755181822000 }, { "id": "3", "name": [ "California" ], "_version_": 1518622755187064800 } ] } } But the suggest query still returns the "New Jersey" in the resultsetlocalhost:8983/solr/mycollection/suggest?q=New&wt=json&indent=true
{ "responseHeader": { "status": 0, "QTime": 0 }, "spellcheck": { "suggestions": [ "New", { "numFound": 2, "startOffset": 0, "endOffset": 3, "suggestion": [ "New Jersey", "New York" ] } ], "collations": [ "collation", "(New Jersey)" ] } }I tried after reloading the admin core and restarting the solr server but the result remains unchanged.
What could be the issue? Is there any cache used by suggester component (solr.SpellCheckComponent)? If yes, how can it be cleared?
Any help would be appreciated.
最满意答案
大多数拼写检查器和建议器不直接在索引之外工作,而是构建并行结构。 在每次提交时都会有一个设置,如果该设置为false,则可以在请求中传递一个标志来触发重建。 对于拼写检查程序,此标志为spellcheck.build或spellcheck.reload 。
因此,请检查您的配置,并尝试显式调用rebuild / reload。
Most of the spell-checkers and suggesters do not work directly off the index but build a parallel structure. There is a setting that builds on every commit and - if that setting is false - there is a flag you can pass in the request to trigger the rebuild. For spellchecker, this flag is spellcheck.build or spellcheck.reload.
So, check what your configuration has and try calling rebuild/reload explicitly.
更多推荐
solr,New,id,mycollection,Jersey,电脑培训,计算机培训,IT培训"/> <meta name=&qu
发布评论