@@ -167,17 +167,19 @@ def get(self, request):
167167                        SearchQuerySet ()
168168                        .models (Personnel )
169169                        .filter (
170-                             SQ (deploying_country_name__contains = phrase )
170+                             ( SQ (deploying_country_name__contains = phrase )
171171                            |  SQ (deployed_to_country_name__contains = phrase )
172-                             |  SQ (event_name__content = phrase )
172+                             |  SQ (event_name__content = phrase ))
173+                             &  SQ (end_date__gt = datetime .now ())
173174                        )
174175                        .order_by ("-_score" )
175176                    )
176177                    surge_alert_response  =  (
177178                        SearchQuerySet ()
178179                        .models (SurgeAlert )
179180                        .filter (
180-                             SQ (event_name__content = phrase ) |  SQ (country_name__contains = phrase ) |  SQ (iso3__contains = phrase )
181+                             (SQ (event_name__content = phrase ) |  SQ (country_name__contains = phrase ) |  SQ (iso3__contains = phrase ))
182+                             &  ~ SQ (status = 'archived' )
181183                        )
182184                        .order_by ("-_score" )
183185                    )
@@ -223,6 +225,7 @@ def get(self, request):
223225                                |  SQ (event_name__content = phrase )
224226                            )
225227                            &  ~ SQ (visibility = "IFRC Only" )
228+                             &  SQ (end_date__gt = datetime .now ())
226229                        )
227230                        .order_by ("-_score" )
228231                    )
@@ -232,6 +235,7 @@ def get(self, request):
232235                        .filter (
233236                            (SQ (event_name__content = phrase ) |  SQ (country_name__contains = phrase ) |  SQ (iso3__contains = phrase ))
234237                            &  ~ SQ (visibility = "IFRC Only" )
238+                             &  ~ SQ (status = 'archived' )
235239                        )
236240                        .order_by ("-_score" )
237241                    )
@@ -278,6 +282,7 @@ def get(self, request):
278282                            |  SQ (event_name__content = phrase )
279283                        )
280284                        &  SQ (visibility = "Public" )
285+                         &  SQ (end_date__gt = datetime .now ())
281286                    )
282287                    .order_by ("-_score" )
283288                )
@@ -287,6 +292,7 @@ def get(self, request):
287292                    .filter (
288293                        (SQ (event_name__content = phrase ) |  SQ (country_name__contains = phrase ) |  SQ (iso3__contains = phrase ))
289294                        &  SQ (visibility = "Public" )
295+                         &  ~ SQ (status = 'archived' )
290296                    )
291297                    .order_by ("-_score" )
292298                )
0 commit comments