Ticket #1708 (closed defect: fixed)

Opened 2 years ago

Last modified 2 years ago

SOLR configuration lost

Reported by: dread Owned by: dread
Priority: blocker Milestone: ckan-sprint-2012-02-06
Component: ckan Keywords:
Cc: Repository: ckan
Theme: none

Description

The SOLR url, user and password defined in the CKAN config file are ignored and the default SOLR url is used.

This causes:

  • "0 datasets" displayed on the home page
  • Dataset searches result in 0 results and a small message "There was an error while searching". (Nothing about it in the logs)

To reproduce

This bug is only visible if your SOLR instance is not at the default place. To quickly reproduce this problem, setup your machine as a SOLR multicore instance and run: "paster db clean && paster create-test-data && paster serve development.ini". It quits with the error: "solr.core.SolrException?: HTTP code=400, reason=Missing solr core name in path"

Code affected

Change History

comment:1 Changed 2 years ago by dread

I've got a fix for this and am just looking to see where this problem started now.

comment:2 Changed 2 years ago by dread

  • Cc ross removed

The problem has traced back to this commit by Ian:

https://github.com/okfn/ckan/commit/51136465fb1bb94ea70df32be00eaef6ae43792b ckan/config/routing.py

-from ckan.plugins import PluginImplementations, IRoutes
 	 10	
+from ckan.controllers.package import set_fallback_controller as set_fallback_package_controller,\
 	 11	
+                                     add_package_controller,\
 	 12	
+                                     set_default_as_fallback_controller_if_required as set_default_as_fallback_package_controller_if_required
 	 13	
+from ckan.plugins import PluginImplementations, IRoutes, IPluggablePackageController

By importing the package controller at this earlier point, it sets the ckan_url quasi-global variable before the config file has been loaded.

  /home/dread/gitroot/ckan/ckan/config/middleware.py(18)<module>()
-> from ckan.config.environment import load_environment
  /home/dread/gitroot/ckan/ckan/config/environment.py(20)<module>()
-> from ckan.config.routing import make_map
  /home/dread/gitroot/ckan/ckan/config/routing.py(10)<module>()
-> from ckan.controllers.package import set_fallback_controller as set_fallback_package_controller,\
  /home/dread/gitroot/ckan/ckan/controllers/package.py(20)<module>()
-> from ckan.lib.search import SearchIndexError, SearchError
  /home/dread/gitroot/ckan/ckan/lib/search/__init__.py(9)<module>()
-> from common import (SearchIndexError, SearchError, SearchQueryError,
> /home/dread/gitroot/ckan/ckan/lib/search/common.py(11)<module>()
-> solr_url = config.get('solr_url', DEFAULT_SOLR_URL)

In retrospect we should have not initialised the variables from the config during import.

comment:3 Changed 2 years ago by dread

Fix on its way.

This problem also stopped simple_search and affected reading the beaker settings.

Patch will make SOLR settings initialised consciously in config/environment.ini, rather than at search import time. I've also moved the search import time to be later.

comment:4 Changed 2 years ago by dread

  • Status changed from new to closed
  • Resolution set to fixed

Fixed in [master 0d3543c]

Note: See TracTickets for help on using tickets.