问题
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