Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to sync MySQL database with solr automatically

I've a database which updates very frequently and I would like solr to synchronise it automatically.

I've 20+ tables but I want my search should be work in only 2 tables and only in some specific field only.

I've put some data manually in solr and run it with get api.

http://127.0.0.1:8983/solr/gettingstarted/select?indent=on&q=:&wt=json

and it works perfectly fine.

can we also do something like if my 'X' users search somethings and in another table I'll check that if post is made by 'X' and his friends then only returns that otherwise not I mean can we get data with conditions as well ?

Please provide some link or resource or any related reference or solution regarding it.

TIA

like image 347
Bill Gates Avatar asked Nov 16 '25 15:11

Bill Gates


1 Answers

There is no automagic syncing in Solr. You'll either have to send the updates to Solr yourself (through the regular POST interface), or trigger a deltaimport through the DataImportHandler if that's what you're using.

For your second case - the answer depends - but the most straight forward way is to include a list of valid usernames or user_ids in your query and then filter against that list (in a fq=posted_by:(foo OR bar OR baz OR ...). This is limited by the number of boolean clauses in your solrconfig.

like image 194
MatsLindh Avatar answered Nov 19 '25 06:11

MatsLindh



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!