mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
* fix: issue search for blocking and blocked_by condition * fix: issue search endpoint blockers * fix: rectify the filter parameters
24 lines
554 B
Python
24 lines
554 B
Python
# Python imports
|
|
import re
|
|
|
|
# Django imports
|
|
from django.db.models import Q
|
|
|
|
# Module imports
|
|
from plane.db.models import Issue
|
|
|
|
|
|
def search_issues(query, queryset):
|
|
fields = ["name", "sequence_id"]
|
|
q = Q()
|
|
for field in fields:
|
|
if field == "sequence_id":
|
|
sequences = re.findall(r"\d+\.\d+|\d+", query)
|
|
for sequence_id in sequences:
|
|
q |= Q(**{"sequence_id": sequence_id})
|
|
else:
|
|
q |= Q(**{f"{field}__icontains": query})
|
|
return queryset.filter(
|
|
q,
|
|
).distinct()
|