-
Notifications
You must be signed in to change notification settings - Fork 19
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
feat: catalog query filtering without elasticsearch #675
Conversation
b740d90
to
f3edd94
Compare
if raw_query_key == 'aggregration__key': | ||
return 'aggregation_key' | ||
elif raw_query_key == 'aggregation__key': | ||
return 'aggregation_key' | ||
elif raw_query_key == 'org__exempt': | ||
return 'org__exclude' |
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.
nit: Could put this in a dict to reduce duplication and allow adding more cases without further stacking the elif tower
if raw_query_key == 'aggregration__key': | |
return 'aggregation_key' | |
elif raw_query_key == 'aggregation__key': | |
return 'aggregation_key' | |
elif raw_query_key == 'org__exempt': | |
return 'org__exclude' | |
corrections_for_typos = { | |
'aggregation_key': ['aggregration__key', 'aggregation__key'], | |
'org__exclude': ['org__exempt'] | |
} | |
for correction, typos in corrections_for_typos.items(): | |
if raw_query in typos: | |
return correction; |
field = None | ||
# comparison_kind defaults to "exact match" | ||
comparison_kind = 'exact' | ||
if len(raw_query_key.split("__")) == 2: |
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.
raw_query_key.split("__")
expression gets duplicated a couple times
if len(raw_query_key.split("__")) == 2: | |
field__comparison = raw_query_key.split("__") | |
if len(field__comparison) == 2: |
if comparison_kind == 'exact': | ||
field_result = any(field_results) | ||
else: | ||
field_result = all(field_results) |
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.
Should the logic be reversed here? I would expect 'exact' matching to require matching all results.
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.
its confusing but "exact" in this case is really mean to be more like "includes" so any of them need to match. if the course key is "edX+Demo" and the query key is like "course_key: [ "edX+Demo", "MIT+Demo"]" you'd want this to match where as the else case is an "excludes" which means NONE of them can match... lemme think about the right way to document this and/or if we need to code this so its easier to understand.
c4618f6
to
f496ea3
Compare
7290c19
to
296dde5
Compare
296dde5
to
90ae3bf
Compare
Description
Given a catalog query and some content metadata - can we determine if the content matches the query without using Elasticsearch (ie
search/all
)?This will be useful when and if:
crawl content once, determine catalogs from our copy (rather than re-crawl content for every query it belongs to)
grind
search/all
lesswe want to process content metadata update events (from event bus)
support catalog contents with similar query syntax but broader sources of content metadata (not everything in discovery)
https://2u-internal.atlassian.net/browse/ENT-7712
Testing