def _convert_notebook_results(self, result, dashboard, query): cols = [ col['name'] if self.source == 'data' else re.sub( '^t\.', '', col['name']) for col in result['meta'] ] docs = [] for row in result['data']: docs.append(dict( (header, cell) for header, cell in zip(cols, row))) response = json.loads('''{ "highlighting":{ "GBP":{ }, "EUR":{ } }, "normalized_facets":[ ], "responseHeader":{ "status":0, "QTime":0, "params":{ "rows":"5", "hl.fragsize":"1000", "hl.snippets":"5", "doAs":"romain", "q":"*:*", "start":"0", "wt":"json", "user.name":"hue", "hl":"true", "hl.fl":"*", "fl":"*" } }, "response":{ "start":0, "numFound":32, "docs":[] } }''') response['response']['docs'] = docs response['response']['numFound'] = len(docs) augment_response(dashboard, query, response) return response
def _convert_notebook_results(self, result, dashboard, query): cols = [col['name'] for col in result['meta']] docs = [] for row in result['data']: docs.append(dict((header, cell) for header, cell in zip(cols, row))) response = json.loads('''{ "highlighting":{ "GBP":{ }, "EUR":{ } }, "normalized_facets":[ ], "responseHeader":{ "status":0, "QTime":0, "params":{ "rows":"5", "hl.fragsize":"1000", "hl.snippets":"5", "doAs":"romain", "q":"*:*", "start":"0", "wt":"json", "user.name":"hue", "hl":"true", "hl.fl":"*", "fl":"*" } }, "response":{ "start":0, "numFound":32, "docs":[] } }''') response['response']['docs'] = docs response['response']['numFound'] = len(docs) augment_response(dashboard, query, response) return response