【问题标题】:Multiple Cores in Django Haystack using Solr Backend使用 Solr 后端的 Django Haystack 中的多个核心
【发布时间】:2011-10-07 06:24:28
【问题描述】:
使用多核时如何配置 HAYSTACK_SOLR_URL?
我已将其设置为 core0 的地址,这可行,但只使用一个核心......
文档对我来说不是那么明显……它只是说
...
# ...or for multicore...
HAYSTACK_SOLR_URL = 'http://127.0.0.1:8983/solr/mysite'
什么是我的网站?
我实际上正在运行 apache-solar-3.3.0/example,其中多核目录复制到示例目录上,并且模式和 conf 文件/目录已更新。
非常感谢。
【问题讨论】:
标签:
django
search
solr
multicore
django-haystack
【解决方案1】:
<cores adminPath="/admin/cores">
<core name="core0" instanceDir="core0" />
<core name="core1" instanceDir="core1" />
</cores>
所以,您可以通过
搜索 core0
http://127.0.0.1:8983/solr/core0/select/?q=*
如果你有一个核心“我的网站”
http://127.0.0.1:8983/solr/mysite/select/?q=*
如果不是多核
http://127.0.0.1:8983/solr/select/?q=*
假设您将 solr 应用命名为“solr”。
请完整参考多核文档。您可以动态加载/卸载核心,甚至可以在不丢弃请求的情况下将一个活动核心与另一个交换。
【解决方案2】:
在我们的项目中,我们有 3 个核心,称为“汽车”“房屋”“工作”
我有我的设置:
CORE_HOUSE = http://localhost:8080/solr/homes/
CORE_HOUSE = http://localhost:8080/solr/cars/
CORE_HOUSE = http://localhost:8080/solr/jobs/
当您需要它们时,您可以参考设置变量(其中 localhost:8080 是您的 solr 安装地址)