Skip to content

Commit

Permalink
Add country name on search for emergency
Browse files Browse the repository at this point in the history
  • Loading branch information
susilnem committed Feb 20, 2025
1 parent 9b88ab9 commit b2e757c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ def get(self, request):
emergency_response = (
SearchQuerySet()
.models(Event)
.filter(SQ(name__content=phrase) | SQ(iso3__content=phrase))
.filter(SQ(name__content=phrase) | SQ(iso3__content=phrase) | SQ(countries__content=phrase))
.order_by("-_score")
)
fieldreport_response = (
Expand Down Expand Up @@ -215,7 +215,10 @@ def get(self, request):
emergency_response = (
SearchQuerySet()
.models(Event)
.filter((SQ(name__content=phrase) | SQ(iso3__content=phrase)) & ~SQ(visibility="IFRC Only"))
.filter(
(SQ(name__content=phrase) | SQ(country__iso3__content=phrase) | SQ(countries__content=phrase))
& ~SQ(visibility="IFRC Only")
)
.order_by("-_score")
)
fieldreport_response = (
Expand Down

0 comments on commit b2e757c

Please sign in to comment.