Synchronize solr documents with database records

Interestingly, there is the right way to solor documents with synchronization database entries. I usually have problems: there are solr documents, while the referent of database records is missing. It seems that some db entries were deleted, but the trigger did not update solr. I want to write a rake task to delete documents in solr that run periodically.

Any suggestions?

Chamnap

+3
source share
3 answers

Yes, there is one.

You should use a DataImportHandler with a delta import function.

, , , , . example.

, HTTP , .

+4

Java + Java DB + Lucene ( Solr ) . , ( + ) Lucene Java DB. , -, , , . , . , . , .

Solr db " ". , , . , , .

0

In addition to the above, soft deletion by setting a column deletedor deleted_atis a great approach. That way, you can run a script to periodically delete deleted records from your Solr index as needed.

You mention the use of rake tasks - is this the Rails application you are working with? Most Solr clients for Rails applications should support deleting records with after_destroy.

0
source

Source: https://habr.com/ru/post/1754189/


All Articles