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

Feature Request: Enhanced EmailMessage QuerySet Filtering #21

Open
MohmdFo opened this issue Dec 8, 2024 · 0 comments · May be fixed by #22
Open

Feature Request: Enhanced EmailMessage QuerySet Filtering #21

MohmdFo opened this issue Dec 8, 2024 · 0 comments · May be fixed by #22

Comments

@MohmdFo
Copy link
Contributor

MohmdFo commented Dec 8, 2024

Description

First, I'd like to express my appreciation for this incredible package! It has streamlined email management and improved our workflows significantly. The well-structured models and filtering capabilities have been particularly useful.

As a contribution, I'd like to propose a new feature to enhance the functionality of filtering the EmailMessage queryset, allowing developers to perform more complex searches with a unified approach.

Feature Proposal

Proposed Functionality:
The addition of a "heavy search" filter that allows developers to:

  1. Perform full-text searches (leveraging SearchVector and SearchQuery for PostgreSQL).
  2. Conduct substring searches (case-insensitive and applicable across database backends).
  3. Utilize trigram similarity search for approximate matching (where supported, such as PostgreSQL).

This filter combines multiple strategies to search across fields like subject, plain_body, and html_body for a comprehensive search experience.

Benefits

  • A unified search mechanism, adaptable to multiple database backends.
  • Enhanced user experience by allowing fallback searches when full-text or similarity searches are unavailable.
  • Simplified API for developers to integrate complex search functionalities seamlessly.

Example Use Case

from sage_mailbox.models import EmailMessage
from sage_mailbox.filters import MailboxMessageFilter

email_queryset = EmailMessage.objects.all()
filterset = MailboxMessageFilter(
    {"search": "invoice payment due"}, queryset=email_queryset
)

results = filterset.qs  # Returns queryset filtered using the proposed "heavy search."

Next Steps

If this enhancement aligns with the package's roadmap, I would love to submit a pull request for this feature. Please assign this issue to me, and I'll ensure the feature is implemented with appropriate documentation and test coverage.

Thank you for considering this proposal, and I look forward to your feedback! 😊

MohmdFo added a commit to MohmdFo/django-sage-mailbox that referenced this issue Dec 8, 2024
Added `MailboxMessageFilter` for enhanced filtering of `EmailMessage` queryset. This feature introduces advanced search capabilities to streamline email management

Closes sageteamorg#21
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 a pull request may close this issue.

1 participant