Skip to content

Commit

Permalink
Merge pull request #4849 from freelawproject/558-implement-es-relevan…
Browse files Browse the repository at this point in the history
…ce-decay

558 Implement Search relevance decay based on date filed
  • Loading branch information
ERosendo authored Jan 6, 2025
2 parents f6bc9e1 + 6e66052 commit b7dac26
Show file tree
Hide file tree
Showing 12 changed files with 1,207 additions and 150 deletions.
3 changes: 2 additions & 1 deletion cl/alerts/tests/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -2392,7 +2392,7 @@ def test_es_alert_update_and_delete(self, mock_abort_audio):
user=self.user_profile.user,
rate=Alert.REAL_TIME,
name="Test Alert OA",
query="type=oa&docket_number=19-1010",
query="type=oa&docket_number=19-1010&order_by=score desc",
alert_type=SEARCH_TYPES.ORAL_ARGUMENT,
)

Expand All @@ -2402,6 +2402,7 @@ def test_es_alert_update_and_delete(self, mock_abort_audio):
response_str = str(doc.to_dict())
self.assertIn("'query': '19-1010'", response_str)
self.assertIn("'rate': 'rt'", response_str)
self.assertNotIn("function_score", response_str)

# Update Alert
search_alert_1.query = "type=oa&docket_number=19-1020"
Expand Down
8 changes: 7 additions & 1 deletion cl/alerts/tests/tests_recap_alerts.py
Original file line number Diff line number Diff line change
Expand Up @@ -2221,13 +2221,19 @@ def test_index_and_delete_recap_alerts_from_percolator(
user=self.user_profile.user,
rate=Alert.WEEKLY,
name="Test Alert Docket Only",
query='q="401 Civil"&type=r',
query='q="401 Civil"&type=r&order_by=score desc',
alert_type=SEARCH_TYPES.RECAP,
)
self.assertTrue(
RECAPPercolator.exists(id=docket_only_alert.pk),
msg=f"Alert id: {docket_only_alert.pk} was not indexed.",
)
alert_doc = RECAPPercolator.get(id=docket_only_alert.pk)
response_str = str(alert_doc.to_dict())
self.assertIn("401 Civil", response_str)
self.assertIn("'rate': 'wly'", response_str)
# function_score breaks percolator queries. Ensure it is never indexed.
self.assertNotIn("function_score", response_str)

docket_only_alert_id = docket_only_alert.pk
# Remove the alert.
Expand Down
Loading

0 comments on commit b7dac26

Please sign in to comment.