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

Update the ocw search page to use the new search apis #1294

Closed
abeglova opened this issue Jan 9, 2024 · 3 comments · Fixed by mitodl/course-search-utils#64 · May be fixed by #1313
Closed

Update the ocw search page to use the new search apis #1294

abeglova opened this issue Jan 9, 2024 · 3 comments · Fixed by mitodl/course-search-utils#64 · May be fixed by #1313
Assignees

Comments

@abeglova
Copy link
Contributor

abeglova commented Jan 9, 2024

We changed the search apis on open to accept filter parameters instead of an open search query. This will be the api we will be using going forward. For now OCW is using the legacy search api that is separately running on open-discussions. We want to update ocw to use the new apis so we no longer need to support the legacy search.

The bulk of the updates will happen in course-search-utils. Currently course-search-utils

  1. Keeps track of search facet state
  2. Keeps the parameters in the url of the search page in sync with the facet state
  3. Generates the open search query

Now that we are moving to a new api we can get rid of (3) but (1) and (2) is still code that we want to share among all uis that use the search.

The work that needs to be done is

In course-search-utils:

  1. Get rid of the large amount of code that generates the open search query and replace it with a small function that formats the active facets into get parameters
  2. Rename the available facets to match the new parameters used by the api. For example the facet formerly known as type is now resource_type and the facet formerly called 'resource_typeiscontent_feature_type`

In ocw-hugo-themes:

  1. Update the code that displays facets to use use the new facet names
  2. Update the code that converts search results to a LearningResource object that can be used by course cards to use the new search result format
  3. Update the code that actually makes the api call to make a get to the new endpoint instead of a post to the old endpoint

To make sure that everything works together the course-search-utils and ocw-hugo-themes work should happen silmultaneously

@abeglova abeglova self-assigned this Jan 9, 2024
@abeglova
Copy link
Contributor Author

One issue with this plan is that the reddit part of open-discussions has a search feature which uses course-search-utils and will be pinned to an old release of course-search-utils. I think this is ok. We don't have plans for further development for discussions and if we ever need to make changes to the query generating code (because of a breaking change in open search, say) we can fork course-search-utils.

@abeglova
Copy link
Contributor Author

Alternatively we can fork course-search-utils now, but I'm hoping we won't need to do more development on the channel/discussion search so we can hold off

@ChristopherChudzicki
Copy link
Contributor

One issue with this plan is that the reddit part of open-discussions has a search feature which uses course-search-utils and will be pinned to an old release of course-search-utils. I think this is ok. We don't have plans for further development for discussions and if we ever need to make changes to the query generating code (because of a breaking change in open search, say) we can fork course-search-utils.

Alternatively we can fork course-search-utils now, but I'm hoping we won't need to do more development on the channel/discussion search so we can hold off

If we release the new version as 3.x, we should be fine. Renovate in open-discussions repository shouldn't bump a major version. And if we ever needed to fix something critical in the old 2.x branch, we could.


I'm going to take a closer look at course-search-utils. There are a few things I think we should consider improving.

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 a pull request may close this issue.

2 participants