Description
Describe the bug
If the user enters a space before the search term in the searchbox and submits that search, no facets will appear next to the products on the search results page. The problem happens e.g. when a user copies the search term from a document and pastes it into the searchbox.
The reason for this is that the logic in the filterForPage
method in the ProductFacetService
checks whether the search term matches the freeTextSearch
propety from the response from the backend. However, the inputs are trimmed in the backend and not in the frontend. This will filter out the searchResult$
for the facets as not relevant.
Tell us the version of Spartacus
- Library version: 2211.28
To Reproduce
Steps to reproduce the behavior:
- Go to home page
- Enter a space followed by any serch term
- Submit that search
- See that there are no facets displayed
Expected behavior
All products and facets should be displayed even with copied spaces before or after the search term. I would expect that the logic that trims the search term corresponds to that in the backend for consistent behavior.