Skip to content

Commit

Permalink
fix: avoids call to DB when checking for queryset
Browse files Browse the repository at this point in the history
  • Loading branch information
Ali-D-Akbar committed Jan 30, 2025
1 parent 245fa13 commit e39de69
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion course_discovery/apps/course_metadata/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1183,7 +1183,8 @@ def search(
QuerySet
"""
query = clean_query(query)
queryset = queryset or cls.objects.all()
if queryset is None:
queryset = cls.objects.all()

if query == '(*)':
# Early-exit optimization. Wildcard searching is very expensive in elasticsearch. And since we just
Expand Down

0 comments on commit e39de69

Please sign in to comment.