Skip to content

Make the API query aware of page namespace

Eric Gardner requested to merge ns-param into main
  • Changes the Start page so that the autocomplete search hits the "prefixsearch" Action API on enwiki. Unlike the newer search endpoint of the REST API, this one actually returns namespace data for the matching pages. So a search for "Talk:Philosophy" will return page objects matching that prefix, and they will all contain a "ns" key with a value of "1". This data is stored along side the actual page title when the user makes a selection from the autocomplete dropdown. Because we rely on this supplemental namespace data, the "search" button is disabled unless the user has actually clicked on a suggestion - raw text input is no longer sufficient.
  • The "go" method in the StartView component has been updated to respond to the presence of this NS id in the user's selection. If the selection has a NS id, then the namespace prefox part of the page title is stripped out, and instead a "ns=1" param is added to the route.
  • The ResultsView will now take this ns parameter into account when making its initial request to the backlinks endpoint.

There are probably some UX improvements we could make to this workflow, but at least the front-end is now namespace-aware.

Merge request reports