Skip to content

Commit

Permalink
fix: multiple filters query in dataset searching page
Browse files Browse the repository at this point in the history
  • Loading branch information
JJJHANG committed Feb 7, 2024
1 parent 7c07575 commit ce39687
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions apps/data/helpers/mod_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit ce39687

Please sign in to comment.