What is "description_url" ?
Closed this issue · 1 comments
Dieterbe commented
The README mentions description_url
, but what is it?
i have a search engine (opensearch 1.1) that can be queried like http://foo.bar/baz/osearch?q=query+terms+go+here
But when I enter http://foo.bar/baz/osearch?q=
, http://foo.bar/baz/osearch?q
, I always get the following:
Traceback (most recent call last):
File "./update-relevancy-data.py", line 4, in <module>
client = Client('http://myurl/osearch?q')
File "/usr/lib/python2.7/site-packages/opensearch/client.py", line 24, in __init__
self.description = Description(url)
File "/usr/lib/python2.7/site-packages/opensearch/description.py", line 15, in __init__
self.load(url)
File "/usr/lib/python2.7/site-packages/opensearch/description.py", line 22, in load
self.dom = parse(urlopen(url))
File "/usr/lib/python2.7/urllib2.py", line 126, in urlopen
return _opener.open(url, data, timeout)
File "/usr/lib/python2.7/urllib2.py", line 398, in open
response = meth(req, response)
File "/usr/lib/python2.7/urllib2.py", line 511, in http_response
'http', request, response, code, msg, hdrs)
File "/usr/lib/python2.7/urllib2.py", line 436, in error
return self._call_chain(*args)
File "/usr/lib/python2.7/urllib2.py", line 370, in _call_chain
result = func(*args)
File "/usr/lib/python2.7/urllib2.py", line 519, in http_error_default
raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
urllib2.HTTPError: HTTP Error 500: failed to parse query
Entering http://foo.bar/baz/osearch?
or http://foo.bar/baz/osearch
gives:
Traceback (most recent call last):
File "./update-relevancy-data.py", line 4, in <module>
client = Client('http://myurlhere/osearch?')
File "/usr/lib/python2.7/site-packages/opensearch/client.py", line 24, in __init__
self.description = Description(url)
File "/usr/lib/python2.7/site-packages/opensearch/description.py", line 15, in __init__
self.load(url)
File "/usr/lib/python2.7/site-packages/opensearch/description.py", line 22, in load
self.dom = parse(urlopen(url))
File "/usr/lib/python2.7/urllib2.py", line 126, in urlopen
return _opener.open(url, data, timeout)
File "/usr/lib/python2.7/urllib2.py", line 398, in open
response = meth(req, response)
File "/usr/lib/python2.7/urllib2.py", line 511, in http_response
'http', request, response, code, msg, hdrs)
File "/usr/lib/python2.7/urllib2.py", line 436, in error
return self._call_chain(*args)
File "/usr/lib/python2.7/urllib2.py", line 370, in _call_chain
result = func(*args)
File "/usr/lib/python2.7/urllib2.py", line 519, in http_error_default
raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
urllib2.HTTPError: HTTP Error 500: invalid search options
Is description_url
supposed to be the location of an xml file describing the actual search engine? we don't use such a file. Can I make it work?
edsu commented
Yes, you need to pass the client the opensearch description file. A description file is required for opensearch clients to know how to construct URLs for your search service. They are really quite simple to put together :-)