Skip to content

Commit b2e757c

Browse files
committed
Add country name on search for emergency
1 parent 9b88ab9 commit b2e757c

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

api/views.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ def get(self, request):
165165
emergency_response = (
166166
SearchQuerySet()
167167
.models(Event)
168-
.filter(SQ(name__content=phrase) | SQ(iso3__content=phrase))
168+
.filter(SQ(name__content=phrase) | SQ(iso3__content=phrase) | SQ(countries__content=phrase))
169169
.order_by("-_score")
170170
)
171171
fieldreport_response = (
@@ -215,7 +215,10 @@ def get(self, request):
215215
emergency_response = (
216216
SearchQuerySet()
217217
.models(Event)
218-
.filter((SQ(name__content=phrase) | SQ(iso3__content=phrase)) & ~SQ(visibility="IFRC Only"))
218+
.filter(
219+
(SQ(name__content=phrase) | SQ(country__iso3__content=phrase) | SQ(countries__content=phrase))
220+
& ~SQ(visibility="IFRC Only")
221+
)
219222
.order_by("-_score")
220223
)
221224
fieldreport_response = (

0 commit comments

Comments
 (0)