Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SolrError: Solr responded with an error (HTTP 400): [Reason: TaggerRequestHandler requires text to be POSTed to it] #282

Open
2 of 3 tasks
akurniawan opened this issue Sep 19, 2019 · 1 comment

Comments

@akurniawan
Copy link

akurniawan commented Sep 19, 2019

I have

  • Tested with the latest release
  • Tested with the current master branch
  • 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

  1. Follow the steps in https://lucene.apache.org/solr/guide/7_4/the-tagger-handler.html#tutorial-with-geonames
  2. 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
@acdha
Copy link
Collaborator

acdha commented Sep 19, 2019

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants