ministryofjustice / find-moj-data

Find MOJ data service • This repository is defined and managed in Terraform
MIT License
4 stars 0 forks source link

🐛 Search query results not always displaying matched descriptions #223

Open LavMatt opened 3 months ago

LavMatt commented 3 months ago

Describe the bug.

In the search results page, because we trim descriptions, we do not display the matched string from the search query in the description if it occurs after the cut-off.

To Reproduce

search escapes in fmd front end. A releases in error chart is returned. The match is description but you'll see the term escapes is not highlighted in the description because we've trimmed it before this part is shown

Expected Behaviour

you’d expect to see the section of the description where your search query matched and the matched string highlighted, in all search results.

Additional context

No response

MatMoore commented 3 months ago

Related to this, if you have multiple words in the query, only the full match will be highlighted. We could improve this by splitting on words and highlighting each word match independently.