简体   繁体   中英

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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