Jarn / collective.solr

9 stars 1 forks source link

Feature: allow to configure host, port and base using product-config #14

Open naro opened 12 years ago

naro commented 12 years ago

Hi,

what about to enable configuration of solr server host/port/base parameters through product config from zope.conf ? I'm wondering how to safely use copy of live site in testing / development environment without polluting solr core used for indexing/search from the live instance. It seems I need to re-configure solr controlpanel every time I update my test/development database from the live server currently and it can be easily forgotten.

I'm not sure what is the best way to implement it though. The best option seems to be change SolrConnectionManager.getConnection and look for product config variables. It would be nice to hide controlpanel host/port/base fields from the form in case of product config variables are found.

Thoughts ?

mjpieters commented 12 years ago

This is certainly something that we have thought of as well. Adding support for a ZConfig section is actually relatively easy, see this StackOverflow answer.

When those values are present the CP fields should really be set to read-only; show the values but do not allow them to be changed.

naro commented 12 years ago

Yes, I'm working on the implementation right now and it is almost finished. I'll post a link to my fork soon

naro commented 12 years ago

See https://github.com/naro/collective.solr/commit/1985a0dd55e3c7c03793d8c8b536581ccdae0903

I'm sorry, I was not able to write tests for this :( I have no idea how to write test for different zope.conf configuration.