Esempio n. 1
0
  def result(self):
     if not self.async_conn:
       raise AsyncSearchError, 'connection died during search'

     if not self._result:
       res = self.async_conn.get_response()
       if res.status != 200:
         self.async_conn.close()
         self.async_conn = None
         raise AsyncSearchError, 'got status %i' % res.status
       else:
         data = res.read()
         res = json.loads(data.encode('utf8'))
         self._result = DBIndexSearchResult.from_dict(res)
     return self._result
Esempio n. 2
0
 def _empty_result(self):
   return DBIndexSearchResult()
Esempio n. 3
0
 def search(self, q):
   d = self._req('POST', '/search', q)
   return DBIndexSearchResult.from_dict(d)