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

Add Elasticsearch 7 support to paying_for_college search behind a flag #6075

Merged
merged 53 commits into from
Oct 28, 2020

Conversation

cwdavies
Copy link
Contributor

@cwdavies cwdavies commented Oct 15, 2020

Places ES7 paying_for_college search functionality behind a flag


Additions

  • Modified paying_for_college search code to work with ES7 behind a flag
  • Created test_search.py with SchoolSearchTest class

Updates

  • Moved test_school_search from test_views.py into test_search.py

How to test this PR

  1. Enable ELASTICSEARCH_DSL_PFC flag
  2. Load up ES7 index cfgov/manage.py search_index --rebuild -f --parallel
  3. Search paying_for_college
    https://cfgov-pr-6075.demo.cfpb.gov/paying-for-college2/understanding-your-financial-aid-offer/api/search-schools.json?q=Kansas

Screenshots

Notes and todos

Checklist

  • PR has an informative and human-readable title
    • PR titles are used to generate the change log in releases; good ones make that easier to scan.
    • Consider prefixing, e.g., "Mega Menu: fix layout bug", or "Docs: Update Docker installation instructions".
  • Changes are limited to a single goal (no scope creep)
  • Code follows the standards laid out in the CFPB development guidelines
  • Future todos are captured in comments and/or tickets
  • Project documentation has been updated, potentially one or more of:
    • This repo’s docs (edit the files in the /docs folder) – for basic, close-to-the-code docs on working with this repo
    • CFGOV/platform wiki on GHE – for internal CFPB developer guidance
    • CFPB/hubcap wiki on GHE – for internal CFPB design and content guidance

Copy link
Member

@higs4281 higs4281 left a comment

Choose a reason for hiding this comment

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

A couple minor comments.
Still want to run more code.

cfgov/paying_for_college/views.py Outdated Show resolved Hide resolved
cfgov/ask_cfpb/documents.py Outdated Show resolved Hide resolved
Copy link
Member

@higs4281 higs4281 left a comment

Choose a reason for hiding this comment

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

This is looking good, but I think we need to make changes to exclude schools that have closed, and to fix autocomplete to enable searches by nickname and school ID.

cfgov/paying_for_college/documents.py Show resolved Hide resolved
cfgov/paying_for_college/documents.py Show resolved Hide resolved
@cwdavies
Copy link
Contributor Author

This is looking good, but I think we need to make changes to exclude schools that have closed, and to fix autocomplete to enable searches by nickname and school ID.

I recommend having a test to confirm a school that has closed is excluded.
Do you know of a specific school that is closed and is in test_fixture.json?

I hope that I have fixed autocomplete to enable searches by school_id and nickname.
Please let me know if those type of searches are working and I will add new test cases.

@higs4281
Copy link
Member

Do you know of a specific school that is closed and is in test_fixture.json?

All the schools in test_fixture.json are operating=true, but you could add one that is closed, or add one within a test to avoid changing result counts in other tests.

Copy link
Member

@higs4281 higs4281 left a comment

Choose a reason for hiding this comment

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

I think we're close. Just some related tweaks, for documents.py, models.search.py, and views.py

cfgov/paying_for_college/documents.py Outdated Show resolved Hide resolved
cfgov/paying_for_college/models/search.py Outdated Show resolved Hide resolved
…oolDocument

Removed str from nicknames in school_autocomplete
because list-as-string is not friendly in the API response
Modified autocomplete to return the default
top 10 hits instead of the entire response set
Copy link
Member

@higs4281 higs4281 left a comment

Choose a reason for hiding this comment

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

App's working well now. Great work!

@cwdavies cwdavies merged commit e6bcef4 into main Oct 28, 2020
@cwdavies cwdavies deleted the pfc-es7-search branch October 28, 2020 17:18
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.

None yet

4 participants