Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(search): Enhances query_string queries #4814

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cl/lib/elasticsearch_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,7 @@ def build_text_filter(field: str, value: str) -> List:
"query": value,
"fields": [field],
"default_operator": "AND",
"quote_field_suffix": ".exact",
}
}
if "caseName" in field and '"' not in value:
Expand Down
39 changes: 39 additions & 0 deletions cl/search/tests/tests_es_recap.py
Original file line number Diff line number Diff line change
Expand Up @@ -864,6 +864,45 @@ def test_filter_docket_with_no_documents(self) -> None:
docket.delete()
docket_2.delete()

def test_cause_filter(self) -> None:
"""Confirm cause filter works properly"""
# Confirm parties extracted from case_name are available in filters.
with self.captureOnCommitCallbacks(execute=True):
d = DocketFactory(
court=self.court,
docket_number="23-cv-12335",
case_name="Lockhart v. Gainwell Technologies LLC",
cause="31:3730 Qui Tam False Claims Act",
source=Docket.RECAP,
)
d_2 = DocketFactory(
court=self.court,
docket_number="22-cv-00526",
case_name="Schermerhorn v. Quality Enterprises USA, Inc.",
cause="31:3730 Qui Tam False Claims Act",
source=Docket.RECAP,
)

cause_str = "31:3730 Qui Tam False Claims Act"
params = {
"type": SEARCH_TYPES.RECAP,
# Do it in main query box
"q": f'cause:"{cause_str}"',
}
async_to_sync(self._test_article_count)(
params, 2, "faceted_cause_query_string"
)
params = {
"type": SEARCH_TYPES.RECAP,
# Do it in the cause field as a phrase
"cause": f'"{cause_str}"',
}
async_to_sync(self._test_article_count)(params, 2, "cause_filter")

with self.captureOnCommitCallbacks(execute=True):
d.delete()
d_2.delete()

def test_party_name_filter(self) -> None:
"""Confirm party_name filter works properly"""

Expand Down
Loading