Solr DIH — How to handle deleted documents?

后端 未结 2 858
情话喂你
情话喂你 2020-12-13 15:34

I\'m playing around with a Solr-powered search for my webapp, and I figured it\'d be best to use the DataImportHandler to handle syncing with the app via the database. I li

2条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-13 16:05

    These are your options:

    • Use DIH special commands $deleteDocById or $deleteDocByQuery (requires Solr 1.4+)
    • Use the clean parameter of DIH to delete the whole index before importing.
    • Use preImportDeleteQuery to define what's going to be cleaned up before importing. (requires Solr 1.4+)
    • Use database triggers instead of DIH to manage updating the index.
    • If you're using some sort of ORM use its interception capabilities instead of DIH. For example you can use hibernate events to update the index on update, insert or delete.

提交回复
热议问题