-
Notifications
You must be signed in to change notification settings - Fork 20
Add aggregations with filters #7
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
Conversation
complaint_search/es_interface.py
Outdated
Field('product', 'Product / Subproduct', 10000, True), | ||
Field('issue', 'Issue / Subissue', 10000, True), | ||
Field('state', 'State', 50, False), | ||
Field('zip_code', 'Zip code', 1000, False), |
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.
Is zip code really 1000 characters?
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.
Also, I think the short field names are more appropriate to exchange in the aggs rather than the longer titles
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.
@JeffreyMFarley This is the size of the results being returned, not the # of characters in the zip code field. I will also take a look at what makes sense for each field as well.
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.
Okay I will use the short name and leave it to the front-end to handle the title.
@@ -36,11 +37,307 @@ def test_search_no_param__valid(self, mock_rget, mock_search): | |||
"fragment_size": 500 | |||
}, | |||
"sort": [{"_score": {"order": "desc"}}], | |||
"post_filter": {"and": {"filters": []}} | |||
"post_filter": {"and": {"filters": []}}, | |||
"aggs": { |
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 was thinking, how in the world is the test file 9K lines? I see now it is due to lots of embedded JSON to validate the responses.
It's fine, but you could always store them as static files in the same directory and keep the test file focused on the test, not the expected data. Here's my version of that pattern
# -------------------------------------------------------------------------
# Helper Methods
# -------------------------------------------------------------------------
def to_absolute(self, fileName):
import os.path
# where is this module?
thisDir = os.path.dirname(__file__)
return os.path.join(thisDir, fileName)
def load(self, shortName):
import json
fileName = self.to_absolute(shortName + '.json')
with open(fileName, 'r') as f:
return json.load(f)
# -------------------------------------------------------------------------
# Test Methods
# -------------------------------------------------------------------------
def test_search_no_param_valid(self):
expected = self.load('search_no_param_valid')
actual = ...
self.assertEqual(actual, expected)
"sub_product": "sub_product.raw", | ||
"issue": "issue.raw", | ||
"sub_issue": "sub_issue.raw" | ||
} |
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.
add company_public_response.raw
and consumer_consent_provided.raw
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.
Currently company_public_response.raw
and consumer_consent_provided.raw
are currently not in the mappings, so it may not work at this moment. @AdamZarger Can you add them to the mapping and I will do the same here for the API
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.
Done
Will merge this in for now. |
Use the latest CSS markup for pagination controls
This is to add aggregations as part of the search.
Additions:
Notes:
This PR does not include the following, but the following items will be worked on in later PRs:
Reviews:
@JeffreyMFarley @AdamZarger
cc @sephcoster