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

Replace django-elasticsearch-dsl-drf with vanilla django-elasticsearch-dsl implementation #2297

Merged
merged 7 commits into from
Feb 20, 2025

Conversation

longhotsummer
Copy link
Contributor

@longhotsummer longhotsummer commented Feb 19, 2025

The django-elasticsearch-dsl-drf library makes it pretty difficult for us to explicitly craft the elasticsearch query. In particular, it's impossible for use to add ES version 8 features like retrievers and RRF (hybrid) searches. It was also difficult to work with and behaved strangely at times. This removes it completely.

This moves the core logic (which we had largely implemented outside of elasticsearch-dsl-drf already) into a SearchEngine class.

This has the benefit that we can craft and call searches outside of DRF.

Copy link

github-actions bot commented Feb 19, 2025

Test Results

71 tests  +68   71 ✅ +68   12s ⏱️ +12s
15 suites +13    0 💤 ± 0 
15 files   +13    0 ❌ ± 0 

Results for commit e3d3817. ± Comparison against base commit e84f864.

This pull request removes 3 and adds 71 tests. Note that renamed tests count towards both.
liiweb.tests.test_legislation_views.LegislationViewsTest ‑ test_legislation_listing_national_only
liiweb.tests.test_mnc_matcher.MncMatcherTest ‑ test_html_matches
liiweb.tests.test_mnc_matcher.MncMatcherTest ‑ test_za_provincial_matches
peachjam.tests.test_adapters.IndigoAdapterTest ‑ test_is_responsible_for_exclude_actors
peachjam.tests.test_adapters.IndigoAdapterTest ‑ test_is_responsible_for_exclude_doctypes
peachjam.tests.test_adapters.IndigoAdapterTest ‑ test_is_responsible_for_exclude_subtypes
peachjam.tests.test_adapters.IndigoAdapterTest ‑ test_is_responsible_for_include_actors
peachjam.tests.test_adapters.IndigoAdapterTest ‑ test_is_responsible_for_include_doctypes
peachjam.tests.test_adapters.IndigoAdapterTest ‑ test_is_responsible_for_include_subtypes
peachjam.tests.test_adapters.IndigoAdapterTest ‑ test_is_responsible_for_places
peachjam.tests.test_admin.TestJudgmentAdmin ‑ test_add_judgment_docx_swap_pdf
peachjam.tests.test_admin.TestJudgmentAdmin ‑ test_add_judgment_pdf_swap_docx
peachjam.tests.test_bulk_import.JudgmentBulkImportTestCase ‑ test_case_number_import_without_matter_type
…

♻️ This comment has been updated with latest results.

Copy link
Contributor

@actlikewill actlikewill left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

everything looks in order. i'm kind of happy for this change. the magic that DRF was doing is now laid bare to see 😄

@longhotsummer
Copy link
Contributor Author

everything looks in order. i'm kind of happy for this change. the magic that DRF was doing is now laid bare to see 😄

Agreed! It turns out it really wasn't doing much for us anyway, and was a very frustrating library to build upon.

@longhotsummer longhotsummer merged commit 6120647 into main Feb 20, 2025
9 checks passed
@longhotsummer longhotsummer deleted the refactor-search branch February 20, 2025 10:48
Copy link

sentry-io bot commented Feb 20, 2025

Suspect Issues

This pull request was deployed and Sentry observed the following issues:

  • ‼️ RequestError: RequestError(400, 'parsing_exception', '[terms] unknown token [END_ARRAY] after [nature]') peachjam_search.tasks.update_saved_search View Issue
  • ‼️ TypeError: Object of type UUID is not JSON serializable /search/api/documents/ View Issue

Did you find this useful? React with a 👍 or 👎

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants