From 69612cc9903bada151b46ce551e7c9fba6b47537 Mon Sep 17 00:00:00 2001 From: r350178982 <32759763+r350178982@users.noreply.github.com> Date: Mon, 29 Sep 2025 14:00:35 +0800 Subject: [PATCH] Update apis.py --- seahub/seadoc/apis.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/seahub/seadoc/apis.py b/seahub/seadoc/apis.py index 4e19f1f4c5..76d1dd94e1 100644 --- a/seahub/seadoc/apis.py +++ b/seahub/seadoc/apis.py @@ -3246,27 +3246,30 @@ class SeadocSearchMetadataRecords(APIView): return api_error(status.HTTP_404_NOT_FOUND, error_msg) search_type = request.GET.get('search_type', None) - file_types, suffix = [], None + file_types, suffix, exclude_type = [], None, None + sorts = [{"column_key": "_file_mtime", "sort_type": "down"}] + basic_filters = [{"column_key": "_is_dir", "filter_predicate": "is", "filter_term": "file"}] + filter_conjunction = 'And' + filters = [] + + if search_type == 'sdoc': suffix = 'sdoc' if search_type == 'file': file_types.append('_document') + exclude_type = 'sdoc' if search_type == 'video': file_types.append('_video') if search_type == 'exdraw': suffix = 'exdraw' if search_type == 'image': file_types.append('_picture') - - sorts = [{"column_key": "_file_mtime", "sort_type": "down"}] - basic_filters = [{"column_key": "_is_dir", "filter_predicate": "is", "filter_term": "file"}] - filter_conjunction = 'And' - filters = [] if suffix: filters.append({"column_key": "_suffix","filter_predicate": "contains","filter_term": suffix}) if file_types: basic_filters.append({"column_key": "_file_type", "filter_predicate": "is_any_of", "filter_term": file_types}) - + if exclude_type: + filters.append({"column_key": "_suffix","filter_predicate": "does_not_contain","filter_term": exclude_type}) fake_view = { "filters":filters, "sorts": sorts,