从集合中删除一些记录后,Apache Solr建议者字典不会更新(Apache Solr suggester dictionary is not updated after removing some

系统教程 行业动态 更新时间:2024-06-14 17:04:03
从集合中删除一些记录后,Apache Solr建议者字典不会更新(Apache Solr suggester dictionary is not updated after removing some records from collection)

我想在上传一些初始数据(在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 resultset

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)" ] } }

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

本文发布于:2023-04-24 21:17:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/dzcp/2050dfe9e294629b5d27a8ee2d10f165.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:字典   建议   suggester   Solr   Apache

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!