toastdriven/pysolr — pull request #134 by nuarhu (2014-10-21 13:41:10+00:00)
Title: Request handler

This is a pull request that contains and replaces #112 , addressing #51 and #52 :

Additionally to specifying request handlers at the method level, it allows to specify a `search_handler` as instance variable. Also, a new instance variable `use_qt_param` is available that allows to change how request handlers are specified in the SOLR URL. The default SOLR behavior is to expect the handler as URL path variable (current #112 implementation). The pre 3.6 default behavior (and still available via configuration) specifies the request handler via `qt` parameter in the URL.

This pull request will allow to specify a custom request handler at construction time and thus allow to configure it as data source for Haystack like this:

HAYSTACK_CONNECTIONS = {
'default': {
'ENGINE': 'haystack.backends.solr_backend.SolrEngine',
'URL': 'http://127.0.0.1:8983/solr/core0'
},
'autocomplete': {
'ENGINE': 'haystack.backends.solr_backend.SolrEngine',
'URL': 'http://127.0.0.1:8983/solr/core0',
'KWARGS': {
'search_handler': '/autocomplete',
#'use_qt_param': False, # False by default
}
},
}

Update README to include documentation of custom handlers.

I had to change the import statement in `get-solr-download-url.py` to make the tests run. (Using 3.4 but actually my fix should be for python3 in general.)