diff --git a/helpdesk/query.py b/helpdesk/query.py index 88e19224..a2fbe16e 100644 --- a/helpdesk/query.py +++ b/helpdesk/query.py @@ -56,18 +56,23 @@ def get_search_filter_args(search): return Q(queue__title__icontains=search[len('queue:'):]) if search.startswith('priority:'): return Q(priority__icontains=search[len('priority:'):]) - return ( - Q(id__icontains=search) | - Q(title__icontains=search) | - Q(description__icontains=search) | - Q(priority__icontains=search) | - Q(resolution__icontains=search) | - Q(submitter_email__icontains=search) | - Q(assigned_to__email__icontains=search) | - Q(ticketcustomfieldvalue__value__icontains=search) | - Q(created__icontains=search) | - Q(due_date__icontains=search) - ) + filter = Q() + for subsearch in search.split("OR"): + subsearch = subsearch.strip() + filter = ( + filter | + Q(id__icontains=subsearch) | + Q(title__icontains=subsearch) | + Q(description__icontains=subsearch) | + Q(priority__icontains=subsearch) | + Q(resolution__icontains=subsearch) | + Q(submitter_email__icontains=subsearch) | + Q(assigned_to__email__icontains=subsearch) | + Q(ticketcustomfieldvalue__value__icontains=subsearch) | + Q(created__icontains=subsearch) | + Q(due_date__icontains=subsearch) + ) + return filter DATATABLES_ORDER_COLUMN_CHOICES = Choices( diff --git a/helpdesk/templates/helpdesk/filters/keywords.html b/helpdesk/templates/helpdesk/filters/keywords.html index adf37a7e..6a3253fe 100644 --- a/helpdesk/templates/helpdesk/filters/keywords.html +++ b/helpdesk/templates/helpdesk/filters/keywords.html @@ -9,5 +9,5 @@
-

{% trans "Keywords are case-insensitive, and will be looked for pretty much everywhere possible. Prepend with 'queue:' or 'priority:' to search by queue or priority." %}

+

{% trans "Keywords are case-insensitive, and will be looked for pretty much everywhere possible. Prepend with 'queue:' or 'priority:' to search by queue or priority. You can also use the keyword OR to combine multiple searches." %}