Aengus Walton
unread,May 10, 2012, 6:53:56 AM5/10/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Python Sunburnt
Hi,
am new to Sunburnt so hopefully I'm not asking something stupid..
When doing a simple query (executing a simple
SolrInterface.query('test').execute() ), I get the following
traceback:
File '<string>', line 2 in itemsearch
File '/home/aengus/.virtualenvs/mini_itemsearch/local/lib/python2.7/
site-packages/pylons/decorators/__init__.py', line 44 in jsonify
data = func(*args, **kwargs)
File '/home/aengus/workspace/mini_itemsearch/itemsearch/controllers/
api_v1.py', line 21 in itemsearch
return query(params)
File '/home/aengus/workspace/mini_itemsearch/itemsearch/lib/solr.py',
line 26 in query
return solr.execute()
File '/home/aengus/.virtualenvs/mini_itemsearch/local/lib/python2.7/
site-packages/sunburnt/search.py', line 599 in execute
result = self.interface.search(**self.options())
File '/home/aengus/.virtualenvs/mini_itemsearch/local/lib/python2.7/
site-packages/sunburnt/sunburnt.py', line 212 in search
return self.schema.parse_response(self.conn.select(params))
File '/home/aengus/.virtualenvs/mini_itemsearch/local/lib/python2.7/
site-packages/sunburnt/schema.py', line 510 in parse_response
return SolrResponse(self, msg)
File '/home/aengus/.virtualenvs/mini_itemsearch/local/lib/python2.7/
site-packages/sunburnt/schema.py', line 646 in __init__
details['responseHeader'] = dict(details['responseHeader'])
KeyError: 'responseHeader'
The xmlmsg string is:
'<?xml version="1.0" encoding="UTF-8"?>\n<response>
\n<responseHeader><status>0</status><QTime>79</QTime><lst
name="params"><str name="q">ein:16dhnwtakze4po5x</str></lst></
responseHeader><result name="response" numFound="1"
start="0"><doc><int name="id">25616</int></doc></result>\n</response>
\n'
However, when I do this query directly with the Solr web interface and
view the source of what XML it returns, I get:
<?xml version="1.0" encoding="UTF-8"?>
<response>
<lst name="responseHeader">
<int name="status">0</int>
<int name="QTime">0</int>
<lst name="params">
<str name="indent">on</str>
<str name="start">0</str>
<str name="q">ein:16dhnwtakze4po5x</str>
<str name="version">2.2</str>
<str name="rows">10</str>
</lst>
</lst>
<result name="response" numFound="1" start="0">
<doc>
<int name="id">25616</int>
</doc>
</result>
</response>
(Notice the fact that Solr *is* returning <lst> elements with
'responseHeader' attributes, not <responseHeader> elements)
So, if sunburnt is trying to find a lst element with attribute
'responseHeader' (lines 644-645 of schema.py), I'm figuring I need to
get it reading something resembling the previous XML paste with
<lst>s.
Can anyone hazard a guess as to where this transformation from <lst
name="responseHeader"> to <responseHeader> is taking place? Is it
what's causing my problem, or am I on the wrong track altogether?
Many thanks
Aengus