Skip to content

Refactor URL query parameter handling

Our previous search used custom functions like getSearchParamsFromURL() to update the URL parameters based on selections on the search results page:

image

Elastic searchUI creates some of these for us when we use the trackUrlState parameter.

We should either:

  • Turn off searchUI's parameter handling and make sure our own version still works
  • See if we can get searchUI to show the filter states, so we can use searchUI for this instead

It probably doesn't make sense to have searchUI do page/query and have our own code just do the filter one, but that is also an option.

In either case:

  • URL parameters should update when changing a value on the results page (query term, page number, filter section)
  • When loading the results page, if URL parameters are present, they should be used to run the initial search
  • URL parameters should not appear when using the form on the homepage/interior page
Edited by Sarah German