Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: avoids call to DB when checking for queryset #4552

Merged
merged 1 commit into from
Feb 3, 2025

Conversation

Ali-D-Akbar
Copy link
Contributor

Fixes the v2 endpoint slowness using is None instead of checking it using a boolean expression.

@Ali-D-Akbar Ali-D-Akbar force-pushed the aakbar/es-avoid-queryset-eval branch from 7894ad5 to f54ecab Compare January 30, 2025 12:40
@@ -1183,7 +1183,7 @@ def search(
QuerySet
"""
query = clean_query(query)
queryset = queryset or cls.objects.all()
queryset = cls.objects.all() if queryset is None else queryset
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nit] I feel it is clearer to write
if queryset is None: queryset = cls.objects.all()

@Ali-D-Akbar Ali-D-Akbar force-pushed the aakbar/es-avoid-queryset-eval branch from f54ecab to e39de69 Compare January 30, 2025 13:32
@Ali-D-Akbar Ali-D-Akbar force-pushed the aakbar/es-avoid-queryset-eval branch from e39de69 to b3b14d5 Compare January 30, 2025 13:32
@Ali-D-Akbar Ali-D-Akbar merged commit 883b144 into master Feb 3, 2025
14 checks passed
@Ali-D-Akbar Ali-D-Akbar deleted the aakbar/es-avoid-queryset-eval branch February 3, 2025 02:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants