简体   繁体   English

使用Solr DIH时,在增量导入中删除不需要的数据

[英]Deleting unwanted data in incremental imports when using Solr DIH

I have a data to be indexed. 我有一个要编制索引的数据。 The table has a column called 'state' which could be 'published' 'drafted' OR 'deleted'. 该表有一个名为'state'的列,可以'发布''起草'或'删除'。 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. 如果数据库中的数据从“已发布”更新为“已删除”,则在使用增量导入时如何从Solr索引中删除此数据。

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. Solr的默认行为是将数据元素的状态从'published'更新为'已发布',这是不希望的,而我想从solr索引中删除它。

You have to use the deletedPkQuery attribute in your dataConfig with the wanted sql statement, eg 您必须使用dataConfig中的deletedPkQuery属性和所需的sql语句,例如

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

Does it work for you? 对你起作用吗? Source http://wiki.apache.org/solr/DataImportHandler Here is a good tutorial for this: http://solr.pl/en/2011/01/03/data-import-handler-%E2%80%93-removing-data-from-index/ 来源http://wiki.apache.org/solr/DataImportHandler这是一个很好的教程: http//solr.pl/en/2011/01/03/data-import-handler-%E2%80%93的拆卸, -数据-从索引/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM