collective / collective.solr

Solr search engine integration for Plone
https://pypi.org/project/collective.solr/
22 stars 46 forks source link

[Plone5.2-rc2/Python3.6] collective.solr 8.0.0a1 - SolrConnectionException #237

Open NicolasGoeddel opened 4 years ago

NicolasGoeddel commented 4 years ago

Hi.

I installed a fresh Plone5.2-rc2 via UnifiedInstaller with Python 3.6 and Postgresql as Relstorage, added collective.solr=8.0.0a1 to the eggs in buildout.cfg, started the instance, added the extension from the control-panel and changed the base path to /solr/mycore in the @@solr-controlpanel view.

Then I downloaded Apache Solr 8.2.0 to the same machine, started it and created a core using the command line solr create -c mycore. I then can access the Solr instance through its webinterface and I get an empty search result as JSON when opening http://server:8983/solr/mycore/select in the browser.

Now when I click on the button Solr Reindex within the solr-controlpanel I get this error:

2019/09/11-16:08:36 reindexing solr catalog...
Es ist leider ein Fehler aufgetreten.
SolrConnectionException

Traceback (innermost last):
  Module ZPublisher.WSGIPublisher, line 155, in transaction_pubevents
  Module ZPublisher.WSGIPublisher, line 337, in publish_module
  Module ZPublisher.WSGIPublisher, line 255, in publish
  Module ZPublisher.mapply, line 85, in mapply
  Module ZPublisher.WSGIPublisher, line 61, in call_object
  Module collective.solr.browser.maintenance, line 140, in reindex
  Module collective.solr.manager, line 98, in getSchema
  Module collective.solr.solr, line 215, in get_schema
  Module collective.solr.solr, line 349, in getSchema
  Module collective.solr.solr, line 109, in __errcheck
collective.solr.exceptions.SolrConnectionException: HTTP code=404, reason=Not Found

Solr shows this message in its log file:

2019-09-11 14:10:09.910 ERROR (qtp157168588-42) [   x:bfd-db] o.a.s.h.a.ShowFileRequestHandler Can not find: schema.xml [/home/solr/solr-8.2.0/server/solr/mycore/conf/schema.xml]
2019-09-11 14:10:09.911 INFO  (qtp157168588-42) [   x:bfd-db] o.a.s.c.S.Request [bfd-db]  webapp=/solr path=/admin/file params={file=schema.xml} status=404 QTime=0

What is schema.xml and where should it come from? Is it the reason for the connection error?

Thank you.

tisto commented 4 years ago

@NicolasGoeddel this seems to be an issue with your Solr installation that has nothing to do with c.solr directly. How do you set up Solr? Have you tried to access Solr directly to see if you properly loaded a Solr core configuration?

NicolasGoeddel commented 4 years ago

@tisto I have no experience with Solr. It's the first time I use it. I am able to go to the webinterface and I can see there the core with the name mycore. Isn't that all what's needed? Because I got a response from http://server:8983/solr/mycore/select I was thinking that it works and I only have to change the base path for c.solr.

What configuration do I need to load? Creating a fresh core is not enough?

tisto commented 4 years ago

@NicolasGoeddel you need to load a proper Solr core configuration that contains a schema that fits to Plone and what c.solr expects.

Here is an example:

https://github.com/kitconcept/kitconcept.recipe.solr/tree/master/config

You don't need to use kitconcept.recipe.solr to set up Solr. Though, you need the Solr core config.

NicolasGoeddel commented 4 years ago

I copied over schema.xml, solrconfig.xml and mapping-FoldToASCII.xml and started Solr again. Then c.solr was able to make a reindex, clear the index.

Now I have to found out more about the whole configuration thing. When I change a document it gets reindexed and when I search for a certain term in top right search bar also Solr is used. That's fine.

I really would appreciate a small documentation to better get into the whole thing.

Thank you for the example.

tisto commented 4 years ago

@NicolasGoeddel I am aware that we are missing documentation here. It took us a huge effort to migrate c.solr to Python 3 and Plone 5.2 and so far we did not had time to write down these things. Maybe you could imagine to help us with a "getting started" document that helps people that use Solr for the first time? Feel free to create a pull request updating the existing README (which is definitely out-of-date).