From ce39687791d13431a9a57307598d008ec46382d6 Mon Sep 17 00:00:00 2001 From: JJJHANG Date: Wed, 7 Feb 2024 14:14:48 +0800 Subject: [PATCH] fix: multiple filters query in dataset searching page --- apps/data/helpers/mod_search.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/apps/data/helpers/mod_search.py b/apps/data/helpers/mod_search.py index 5ae07a9b..e1053434 100644 --- a/apps/data/helpers/mod_search.py +++ b/apps/data/helpers/mod_search.py @@ -63,7 +63,8 @@ def _estimate_count(self): qs = query.model._base_manager.all() compiler = query.query.get_compiler('default') - #print (qs, compiler) + # print(f'qs: {qs}') + # print(f'complier: {compiler}') where, params = compiler.compile(query.query.where) qs = qs.extra(where=[where] if where else None, params=params) @@ -136,8 +137,8 @@ def get_results(self): ret = { 'elapsed': self.timed[1] - self.timed[0], 'count': int(count), - 'count_estimate1':self._estimate_count_all(), - 'count_estimate2': self._estimate_count(), + # 'count_estimate1':self._estimate_count_all(), + # 'count_estimate2': self._estimate_count(), 'limit': limit, 'offset': offset, 'has_more': True if count > 0 and offset + limit <= count else False, @@ -330,7 +331,7 @@ def __init__(self, filters): query = query.order_by(*values) if key == 'source': - query = query.filter(source=values[0]) + query = query.filter(source__in=values) self.query = query