pysolr
pysolr copied to clipboard
SolrError: Solr responded with an error (HTTP 400): [Reason: TaggerRequestHandler requires text to be POSTed to it]
I have
- [x] Tested with the latest release
- [ ] Tested with the current master branch
- [x] Searched for similar existing issues
Expected behaviour
Able to request to Solr server and getting response
Actual behaviour
Getting error as follows
---------------------------------------------------------------------------
SolrError Traceback (most recent call last)
<ipython-input-28-e8db800b73ab> in <module>
4 "fl": "id,name,countrycode",
5 "wt": "json",
----> 6 "indent": "on"
7 })
8
/anaconda2/envs/us-entity/lib/python3.6/site-packages/pysolr.py in search(self, q, search_handler, **kwargs)
740 params = {'q': q}
741 params.update(kwargs)
--> 742 response = self._select(params, handler=search_handler)
743 decoded = self.decoder.decode(response)
744
/anaconda2/envs/us-entity/lib/python3.6/site-packages/pysolr.py in _select(self, params, handler)
435 # Typical case.
436 path = '%s/?%s' % (handler, params_encoded)
--> 437 return self._send_request('get', path)
438 else:
439 # Handles very long queries by submitting as a POST.
/anaconda2/envs/us-entity/lib/python3.6/site-packages/pysolr.py in _send_request(self, method, path, body, headers, files)
410 'request_body': bytes_body,
411 'request_headers': headers}})
--> 412 raise SolrError(error_message % (resp.status_code, solr_message))
413
414 return force_unicode(resp.content)
SolrError: Solr responded with an error (HTTP 400): [Reason: TaggerRequestHandler requires text to be POSTed to it]
Steps to reproduce the behaviour
- Follow the steps in https://lucene.apache.org/solr/guide/7_4/the-tagger-handler.html#tutorial-with-geonames
- Run the following code
import pysolr
solr = pysolr.Solr('http://localhost:[port]/solr/geonames')
results = solr.search('New York City', search_handler="/tag", **{
"overlaps": "NO_SUB",
"tagsLimit": 5000,
"fl": "id,name,countrycode",
"wt": "json",
"indent": "on"
})
Configuration
- Operating system version: Ubuntu 16.04
- Search engine version: 7.5
- Python version: 3.6
- pysolr version: 3.8.1
This sounds like it's working correctly – the search method uses the select handler and expects a certain result format. It sounds like what you need is adding a separate tag handler which follows that API just as for older interfaces like more-like-this: https://github.com/django-haystack/pysolr/blob/master/pysolr.py#L801