URLs in API response need correction

Created on 14 August 2025, about 2 months ago

Problem/Motivation

There are two issues here, but since they both have to do with URLs returned in the REST resource response, I'm lumping them in together

  1. Search results ignore the 'Remove Domain from Result Link URLs' configuration. This was a useful feature so that when testing search on a lower environment, the search results would have relative links and would link to the lower environment instead of all the results linking back to prodution.
  2. The tokens for the original URL and corrected URL are populated based on the server environment and not based on the client environment. For clients that use the API, the domain and path of the search page can be anything. When a search keyword is corrected but you want to provide a link to perform the search against the wrongly spelled word anyway the link should be based on the client search path and not on the server custom search page path.

Steps to reproduce

  1. Make a call to the REST resource for a custom search page. In the response, you will see that the results all have absolute links to the production environment.
  2. Make a call to the REST resource for a custom search page. Use an improperly spelled word that will get corrected. Examine the originalUrl returned in the response. It shows the URL associated with the custom search page on the server side rather than the url of the client search page.

Proposed resolution

  1. Move the process of removing the domain from sesarch results into the search service rather than in the presentation logic. This works fine when not using a decoupled architecture and the search page on Drupal. It fails when the search page lives on a client that uses the REST resource to get the results.
  2. Accept a 'searchPath' query string parameter that can be added to the query string of search requests. Also, have a setting that sets a default searchPath for clients that use the api.
πŸ› Bug report
Status

Active

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States tzura

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024