-
Notifications
You must be signed in to change notification settings - Fork 2
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 page cleanup #675
Search page cleanup #675
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #675 +/- ##
==========================================
+ Coverage 72.58% 75.18% +2.59%
==========================================
Files 281 260 -21
Lines 12581 11721 -860
Branches 2184 2030 -154
==========================================
- Hits 9132 8812 -320
+ Misses 3265 2727 -538
+ Partials 184 182 -2 ☔ View full report in Codecov by Sentry. |
/** | ||
* Augment the facet buckets for `groupKey` with active values that have no | ||
* results. | ||
*/ | ||
const includeActiveZerosInBuckets = ( | ||
groupKey: string, | ||
aggregations: LearningResourceSearchResponse["metadata"]["aggregations"], | ||
params: LRSearchRequest, | ||
) => { |
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.
@abeglova Maybe the FacetDisplay
component should handle this? OCW does seem to add-in active facets with zero count, but I don't think it's in course-search-utils currently?
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 agree, I think it makes sense for this to be moved to FacetDisplay in course-search-utils.
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.
Sounds good. I'd like to do that separately from mitodl/course-search-utils#78, but I can do it before merging this PR.
mitodl/course-search-utils#78 is big enough already, and I'd like replace the Enzyme-based facet tests if I'm going to be adding more there.
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.
This works great!
I agree with you that includeActiveZerosInBuckets should be moved to course-search-utils.
Additionally it looks like you implemented useValidatedSearchParams in course-search-utils but are not using it in this pr - I can search for an invalid param such as http://localhost:8063/search/?topic=monkey and it adds monkey to the topics list
/** | ||
* Augment the facet buckets for `groupKey` with active values that have no | ||
* results. | ||
*/ | ||
const includeActiveZerosInBuckets = ( | ||
groupKey: string, | ||
aggregations: LearningResourceSearchResponse["metadata"]["aggregations"], | ||
params: LRSearchRequest, | ||
) => { |
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 agree, I think it makes sense for this to be moved to FacetDisplay in course-search-utils.
const useResourceSearchParams = ({
searchParams,
setSearchParams,
facets = [],
onFacetsChange
}: UseValidatedSearchParamsProps<ResourceSearchRequest>) => {
return useValidatedSearchParams<ResourceSearchRequest>({
searchParams,
setSearchParams,
facets,
validators: resourceSearchValidators,
onFacetsChange
})
}
The validation is based on the OpenAPI spec, by which |
59b4be8
to
226ca98
Compare
@ChristopherChudzicki if it's not too late can we change the order of tabs to all, courses, programs, podcasts ? |
|
What are the relevant tickets?
For #640
Description (What does it do?)
This PR makes several changes to the search page:
http://localhost:8063/search?platform=mitx
Screenshots (if appropriate):
How can this be tested?
Visit http://localhost:8063/search
Try:
Things to look out for
Append a filter not included in the UI to the URL; for example
?platform=mitxonline
or (&platform=mitxonline
). The results should update.Additional Context