3

I have a data to be indexed. The table has a column called 'state' which could be 'published' 'drafted' OR 'deleted'. Now I only index the data which has a state as 'published'. If a data in database is updated to 'deleted' from 'published' how do I deleted this data from my Solr index when using incremental imports.

The default behaviour of Solr will be to update the state of the data element to 'deleted' from 'published' which is not desired, rather i want to delete it from the solr index.

4

1 回答 1

7

您必须将 dataConfig 中的 deletedPkQuery 属性与所需的 sql 语句一起使用,例如

deletedPkQuery="select ID from table where state = 'deleted'"

对你起作用吗?来源http://wiki.apache.org/solr/DataImportHandler 这是一个很好的教程:http ://solr.pl/en/2011/01/03/data-import-handler-%E2%80%93 -从索引中删除数据/

于 2012-08-29T09:10:18.417 回答