Skip to content

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

@abeglova

Description

@abeglova

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions