Multiple Cores in Django Haystack using Solr Backend

时光总嘲笑我的痴心妄想 提交于 2019-12-22 17:59:43

问题


How do I configure HAYSTACK_SOLR_URL when using multiple cores?

I've set it to the address of core0, and that works, but only using one core…

The docs aren't that obvious to me… it just says

...
# ...or for multicore...
   HAYSTACK_SOLR_URL = 'http://127.0.0.1:8983/solr/mysite'

What is mysite?

I'm actually running apache-solar-3.3.0/example with the multicore directory copied over the example directory, and the schema and conf files/directories updated.

Many thanks.


回答1:


  <cores adminPath="/admin/cores">
    <core name="core0" instanceDir="core0" />
    <core name="core1" instanceDir="core1" />
  </cores>

So, you would search core0 by

http://127.0.0.1:8983/solr/core0/select/?q=*

If you had a core "mysite"

http://127.0.0.1:8983/solr/mysite/select/?q=*

Whereas if it were not multi-core

http://127.0.0.1:8983/solr/select/?q=*

assuming you named your solr app as "solr".


Do refer the multi-core docs in full. You can dynamically load/unload cores and even swap a live core with another without dropping requests.




回答2:


in our project, we have 3 cores, called "cars" "homes" "jobs"

i settings i have:

CORE_HOUSE = http://localhost:8080/solr/homes/
CORE_HOUSE = http://localhost:8080/solr/cars/
CORE_HOUSE = http://localhost:8080/solr/jobs/

whenever you need them, you refer to the settings variable (where localhost:8080 is your solr installation address)



来源:https://stackoverflow.com/questions/7683717/multiple-cores-in-django-haystack-using-solr-backend

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!