简体   繁体   English

如何自动将MySQL数据库与solr同步

[英]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. 我有一个非常频繁更新的数据库,我希望solr自动同步它。

I've 20+ tables but I want my search should be work in only 2 tables and only in some specific field only. 我有20多个表,但我希望我的搜索只能在2个表中工作,而且只能在某个特定的字段中工作。

I've put some data manually in solr and run it with get api. 我已经在solr中手动输入了一些数据并使用get api运行它。

http://127.0.0.1:8983/solr/gettingstarted/select?indent=on&q= : &wt=json 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 ? 我们还可以做一些事情,比如我的'X'用户搜索某些事情和另一个表格我将检查如果帖子是由'X'和他的朋友制作然后只返回,否则不是我的意思是我们能获得有条件的数据?

Please provide some link or resource or any related reference or solution regarding it. 请提供一些链接或资源或任何相关的参考或解决方案。

TIA TIA

There is no automagic syncing in Solr. 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. 您必须自己(通过常规POST界面)将更新发送给Solr,或者通过DataImportHandler触发deltaimport,如果这是您正在使用的。

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. 对于你的第二种情况 - 答案取决于 - 但最直接的方法是在查询中包含有效用户名或user_ids的列表,然后对该列表进行过滤(在fq=posted_by:(foo OR bar OR baz OR ...) 。这受到solrconfig中布尔子句数量的限制。

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

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