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 admin search slow #1750

Merged
merged 2 commits into from
Nov 13, 2023
Merged

Fix admin search slow #1750

merged 2 commits into from
Nov 13, 2023

Conversation

Uxio0
Copy link
Member

@Uxio0 Uxio0 commented Nov 9, 2023

@Uxio0 Uxio0 marked this pull request as ready for review November 10, 2023 16:12
@Uxio0 Uxio0 requested a review from a team as a code owner November 10, 2023 16:12
- Implement new AdvancedAdminSearchMixin
- Don't convert every value to text for search, so DB indexes can be used
- Change admin search from `iexact (=)`  to `exact (==)`
"""

# Apply keyword searches.
print("HOLA")
Copy link
Member

Choose a reason for hiding this comment

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

Hello!

@@ -26,7 +26,6 @@ class SafeMessageConfirmationAdmin(BinarySearchAdmin):
list_select_related = ("safe_message",)
ordering = ["-created"]
search_fields = [
"=safe_message__safe",
"=owner",
"safe_message__description",
Copy link
Member

Choose a reason for hiding this comment

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

description was removed from filter, are you aware of this?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, it was not posible to search for text when using a JOIN, so there was an error here

- Implement new AdvancedAdminSearchMixin
- Don't convert every value to text for search, so DB indexes can be used
- Change admin search from `iexact (=)`  to `exact (==)`
@Uxio0 Uxio0 merged commit a640dc8 into master Nov 13, 2023
6 checks passed
@Uxio0 Uxio0 deleted the fix-admin-search branch November 13, 2023 12:25
@github-actions github-actions bot locked and limited conversation to collaborators Nov 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Admin search is really slow for some models
2 participants