Java Solr删除由于某种原因不起作用

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2358476/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-13 06:31:50  来源:igfitidea点击:

Solr delete not working for some reason

javasearchsolr

提问by Blankman

Just trying to delete all the documents, and did this:

只是试图删除所有文件,然后这样做:

http://localhost:8983/solr/update?stream.body=%3Cdelete%3E%3Cquery%3E*:*%3C/query%3E%3C/delete%3E

then committed:

然后承诺:

http://localhost:8983/solr/update?stream.body=%3Ccommit/%3E

I get the response:

我得到回应:

<lst name="responseHeader">
<int name="status">0</int>
<int name="QTime">17</int>
</lst>
</response>

But when I search I still get results back.

但是当我搜索时,我仍然会得到结果。

What did I do wrong?

我做错了什么?

采纳答案by mlathe

Not sure if it matters but you might encode the : too

不确定这是否重要,但您也可以对 : 进行编码

http://localhost:8983/solr/update?stream.body=%3Cdelete%3E%3Cquery%3E*%3A*%3C%2Fquery%3E%3C%2Fdelete%3E

Another thing to try is to use the POST method (the preferred way to call update):

另一件要尝试的事情是使用 POST 方法(调用更新的首选方式):

curl http://localhost:8983/solr/update?commit=true -H "Content-Type: text/xml" --data-binary '<delete><query>*:*</query></delete>'

回答by Juampa

In Lucene wiki :

在 Lucene 维基中:

it will still be found, because index changes are not visible until, and a new searcher is opened. To cause this to happen, send a commit command to Solr (post.jar does this for you by default)

它仍然会被找到,因为索引更改是不可见的,直到打开一个新的搜索器。要导致这种情况发生,请向 Solr 发送提交命令(post.jar 默认为您执行此操作)

Maybe you can POST a <commit/>message to Solr.

也许您可以<commit/>向 Solr 发布一条消息。

回答by Tim P

Put the commit=true parameter in you GET request:

将 commit=true 参数放在您的 GET 请求中:

http://localhost:8983/solr/update?stream.body=%3Cdelete%3E%3Cquery%3E*:*%3C/query%3E%3C/delete%3E&commit=true

http://localhost:8983/solr/update?stream.body=%3Cdelete%3E%3Cquery%3E*:*%3C/query%3E%3C/delete%3E&commit=true

回答by Pete

Remember to clear the browser cache! I thought I was having the same problem, but it turned out that the browser had just cached the result and was returning the cached page. D'oh!

记得清除浏览器缓存!我以为我遇到了同样的问题,但结果是浏览器刚刚缓存了结果并返回了缓存的页面。哦!

回答by Tyler Long

http://localhost:8983/solr/update?stream.body=<delete><query>*:*</query></delete>&commit=true

回答by whitehorse

Probably you are missing a forward slash (/) after update and before question mark.

可能您/在更新之后和问号之前缺少正斜杠 ( )。

Current query:

当前查询:

http://localhost:8983/solr/update?stream.body=<delete><query>*:*</query></delete>&commit=true

Revised query:

修改后的查询:

http://localhost:8983/solr/update/?stream.body=<delete><query>*:*</query></delete>&commit=true

回答by Rob

I got stung with this one recently as well. Just remember that if you have updateLog is configured in solrconfig.xml, but there is no versionfield in the schema.xml

我最近也被这个刺痛了。只要记住,如果你在solrconfig.xml中配置了updateLog,但是schema.xml中没有version字段

see https://issues.apache.org/jira/browse/SOLR-3432

https://issues.apache.org/jira/browse/SOLR-3432

I Spent a good hour on this one!!!

我在这个上花了一个小时!!!