1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-28 16:17:02 +00:00

[api2] Improve search results

This commit is contained in:
poetwang
2013-12-11 09:50:59 +08:00
parent 3b65effbad
commit 11fb5bc535

View File

@@ -268,6 +268,19 @@ class Search(APIView):
results, total, has_more = search_keyword(request, keyword) results, total, has_more = search_keyword(request, keyword)
for e in results: for e in results:
e.pop('repo', None) e.pop('repo', None)
e.pop('content_highlight', None)
e.pop('exists', None)
e.pop('last_modified_by', None)
e.pop('name_highlight', None)
e.pop('score', None)
try:
path = e['fullpath'].encode('utf-8')
file_id = seafile_api.get_file_id_by_path(e['repo_id'], path)
e['oid'] = file_id
e['size'] = get_file_size(file_id)
except SearpcError, e:
pass
res = { "total":total, "results":results, "has_more":has_more } res = { "total":total, "results":results, "has_more":has_more }
return Response(res) return Response(res)