Solr的多核搜索 [英] Solr MultiCore Search
问题描述
我使用的 Apache Solr实现 搜索。我使用它来提供个人用户基于搜索。即每个用户都有一个单独的物理Lucene索引。因此,对于10个用户,我有10个单独的物理指标在磁盘上。
I am using Apache Solr for search. I use this to provide personal user-based search. i.e. each user has a separate physical Lucene Index. So for 10 users, I have 10 separate physical indexes on disk.
要支持这些索引搜索,我计划使用 Solr的多核功能 。随着我一直在阅读这方面的各种文章,它看起来像这样是可行的。
To support searches on these indexes, I am planning to use Solr MultiCore Feature. With the various articles I have been reading regarding this, it looks like this would work.
在哪里我其实不知道的,当一个Solr的搜索得到的查询,而不是将查询发送到所有的多内核,我怎么漏斗查询到该核心具有这个特定用户的指数连接?这是一个配置改变或做我需要做code水平的变化?
Where I am actually not sure is, when a solr searcher gets a query, instead of sending the query to all the multiple-cores, how do I funnel the query to that core which has that particular user's index connected to? Is this a config change or do I need to do code level changes?
即。我想将查询发送到只有一个Solr的核心(基于用户ID)。这甚至可能?
i.e. I want to send the query to only one solr-core (based on userid). Is this even possible?
更新:因此根据solutons我可以在开始的Solr时加入solrconfig.xml中即多核我需要提到的一个核心(或在我的情况的用户)。所以,现在,如果我想添加一个新用户的指数,我可能需要停止Solr的,编辑其配置,添加用户的核心和放大器; Solr的重新开始。有什么办法来动态内核添加到正在运行的Solr的实例吗?
UPDATE: So according to one of the solutons I can add multi-cores in the solrconfig.xml i.e. at the time of starting solr I'll need to mention the cores (or in my case the users). So now, if I want to add a new user's index, I'll probably need to stop solr, edit its config, add that users core & start solr again. Is there any way to dynamically add cores to a running solr instance?
推荐答案
Solr的内核本质上是多个指标在应用服务器在同一环境中运行。你可以把它当作安装的 1战文件的每个用户。每个核心都通过一个名字分开,因此必须的亲自的跟踪哪些URL是有效的用户。
Solr cores are essentially multiple indices run in the same context on an application server. You can think of it as installing 1 war-file for each user. Each core is separated by a name, hence you must yourself keep track of which url is valid for which user.
例如,
http://host.com/solr/usercore1/select?q=test
http://host.com/solr/usercore2/select?q=test
其中基于所述配置的 solr.xml 的
<solr persistent="true" sharedLib="lib">
<cores adminPath="/admin/cores">
<core name="usercore1" instanceDir="usercore1" />
<core name="usercore2" instanceDir="usercore1" />
</cores>
</solr>
...而不是将查询发送到所有的多芯...
...instead of sending the query to all the multiple-cores...
这种方法被称为分片,并基于分布式搜索,这是一个完全独立的功能,它的重点是分裂的有一个的用户价格指数比的多个的Solr的实例。
This approach is called sharding and is based on distributed searching, which is a completely separate feature which focuses on splitting one users index over multiple solr instances.
一个方法来创建新的内核是solrj它提供了一个常规的 CoreAdmin.createCore(..)
。你也可以做到这一点使用手动HTTP请求: /核心行动=创建和放大器;名称= usercore3
...
的Solr还可以动态加载其配置,如果你有在地方一个脚本编辑的内核的配置这些改变也应该被拾起。
Solr can also reload its config dynamically, if you had a script in place which edited the cores config these changes should be picked up too.
这篇关于Solr的多核搜索的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!