-
Notifications
You must be signed in to change notification settings - Fork 112
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 Document class for Regulations3k #6058
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One quick comment, but I love how simple and readable this is.
@@ -0,0 +1,42 @@ | |||
from unittest import TestCase |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would we want Django's TestCase here instead of unittest?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good Question, I hadn't considered the differences but upon some research I don't think we need Django's TestCase:
Using unittest.TestCase avoids the cost of running each test in a transaction and flushing the database, but if your tests interact with the database their behavior will vary based on the order that the test runner executes them. This can lead to unit tests that pass when run in isolation but fail when run in a suite.
This doesn't rely on a database, we are just defining the class and preparing the document in memory, so I think unittest.TestCase makes more sense here
…erfinance.gov into regulations-document
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One nit suggestion.
Co-authored-by: william higgins <higs4281@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to do some more testing of Haystack operations.
Adds the model for our regulations3k document that we search on. This will allow us to create and index all regulations in ES7.
Additions
SectionParagraphDocument
- Represents the data we load into elasticsearch for regulations.How to test this PR
cfgov/manage.py search_index --rebuild -f
and all regulations are loaded into ES7 indexregulations3k
. Can be confirmed via the kibana dashboard.Checklist
/docs
folder) – for basic, close-to-the-code docs on working with this repo