solr cannot delete anything

六眼飞鱼酱① 提交于 2019-12-06 09:25:59
samy

I found the reason: bug in solr 4.0.0 alpha

the field:

<field name="_version_" type="long" indexed="true" stored="true"/>

is required for deleting in your schema.xml file if you enable the update log in your solrconfig.xml, if you don't have this field your delete update queries are ignored.

<updateHandler class="solr.DirectUpdateHandler2">
  <updateLog>
    <str name="dir">${solr.data.dir:}</str>
  </updateLog>
</updateHandler>

This happens to everyone who uses the configurations from the examples in solr and just changes the Schema.xml file.

I have a working code like this:

SolrServer solrServer;
String url = "http://localhost:8080/solr";
solrServer = new HttpSolrServer(url);
solrServer.deleteByQuery("*:*");
solrServer.commit();

My Solr version is 3.6.1.

user4149720
//Delete particular column using Solr

SolrServer solrServer;

solrServer = new HttpSolrServer(url);

solrServer.deleteByQuery("columnName:value");

solrServer.commit();
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!