@@ -626,10 +626,20 @@ def index():
626626 mimetype='application/json')
627627 elif output_format == 'csv':
628628 csv = UnicodeWriter(StringIO())
629− keys = ('title', 'url', 'content', 'host', 'engine', 'score')
629+ keys = ('title', 'url', 'content', 'host', 'engine', 'score', 'type')
630630 csv.writerow(keys)
631631 for row in results:
632632 row['host'] = row['parsed_url'].netloc
633+ row['type'] = 'result'
634+ csv.writerow([row.get(key, '') for key in keys])
635+ for a in result_container.answers:
636+ row = {'title': a, 'type': 'answer'}
637+ csv.writerow([row.get(key, '') for key in keys])
638+ for a in result_container.suggestions:
639+ row = {'title': a, 'type': 'suggestion'}
640+ csv.writerow([row.get(key, '') for key in keys])
641+ for a in result_container.corrections:
642+ row = {'title': a, 'type': 'correction'}
633643 csv.writerow([row.get(key, '') for key in keys])
634644 csv.stream.seek(0)
635645 response = Response(csv.stream.read(), mimetype='application/csv')