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

Search legislation TOC #1801

Merged
merged 7 commits into from
Apr 29, 2024
Merged

Search legislation TOC #1801

merged 7 commits into from
Apr 29, 2024

Conversation

longhotsummer
Copy link
Contributor

@longhotsummer longhotsummer commented Apr 19, 2024

Closes #1759

  • make TOC searchable
  • show TOC in search hits for legislation
  • use cards for search hits to better visually separate hits; this reduces the amount of indentation needed

https://www.loom.com/share/04d48383ebbe44299f2548f4967f282d

image

Note

This requires re-creating index mappings and re-indexing all content :(

This automatically adds the new field to the mapping as a migration. We can then re-index legislation content only, at our leisure, without breaking search at all.

@longhotsummer longhotsummer marked this pull request as draft April 19, 2024 15:17
@longhotsummer longhotsummer changed the title Search index toc Search legislation TOC Apr 26, 2024
@longhotsummer longhotsummer marked this pull request as ready for review April 26, 2024 17:26
from django_elasticsearch_dsl.registries import registry

if not settings.DEBUG:
for ix in registry.get_indices():
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this allows us to add the new field to the mapping (which is allowed without having to destroy and re-create the mapping).

we only do it when DEBUG = False because we don't have an ES to talk to when testing.

Copy link
Contributor

Choose a reason for hiding this comment

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

neat

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.

really cool. It really improves legislation search

@longhotsummer longhotsummer merged commit 2a3a3cf into main Apr 29, 2024
9 checks passed
@longhotsummer longhotsummer deleted the search-index-toc branch April 29, 2024 16:28
Copy link

sentry-io bot commented Apr 29, 2024

Suspect Issues

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

  • ‼️ AttributeError: 'Settings' object has no attribute 'ELASTICSEARCH_DSL_AUTOSYNC' peachjam_search.migrations.0001_es_mapping_add_... View Issue
  • ‼️ NotFoundError: NotFoundError(404, 'index_not_found_exception', 'no such index [liiweb_fra]', liiweb_fra, index_o... peachjam_search.migrations.0001_es_mapping_add_... 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.

Search: index AKN document provisions separately; boost title matches; show in results
2 participants