dspace-angular icon indicating copy to clipboard operation
dspace-angular copied to clipboard

Search in sidebar/facet don't escape special characters

Open alexandrevryghem opened this issue 2 years ago • 5 comments

References

Description

The facet search, that uses the endpoint /server/api/discover/facets/{facetName}, in the search sidebar (expand filter in sidebar, start typing in search bar of that facet) didn't escape special characters.

Instructions for Reviewers

Checklist

  • [x] My PR is small in size (e.g. less than 1,000 lines of code, not including comments & specs/tests), or I have provided reasons as to why that's not possible.
  • [x] My PR passes TSLint validation using yarn run lint
  • [x] My PR doesn't introduce circular dependencies
  • [x] My PR includes TypeDoc comments for all new (or modified) public methods and classes. It also includes TypeDoc for large or complex private methods.
  • [x] My PR passes all specs/tests and includes new/updated specs or tests based on the Code Testing Guide.
  • [x] If my PR includes new, third-party dependencies (in package.json), I've made sure their licenses align with the DSpace BSD License based on the Licensing of Contributions documentation.

alexandrevryghem avatar Oct 20 '22 13:10 alexandrevryghem

hello @alexandrevryghem

What we do is to normalize the string, we remove the accents, more or less like this

indexOfCoincidence(completeTerm: string, subTerm: string){ completeTerm = completeTerm.normalize('NFD').replace(/[\u0300-\u036f]/g, "").toUpperCase(); subTerm = subTerm.normalize('NFD').replace(/[\u0300-\u036f]/g, "").toUpperCase(); return completeTerm.indexOf(subTerm) } If you like my idea, I can check it in more detail, it works like this:

image

jtimal avatar Oct 24 '22 03:10 jtimal

Hey @jtimal

I looked into this and your solution does indeed work for normalizing the accents but it would also require extra backend changes to ignore accents when searching for the results too. So you should probably create a new issue for this.

alexandrevryghem avatar Oct 24 '22 15:10 alexandrevryghem

Hi @alexandrevryghem thanks for reading me,

Ok, I'm fine with it, I just don't know how to create this request, do we wait for Tim to review it or do we let him know?

jtimal avatar Oct 24 '22 16:10 jtimal

I just don't know how to create this request

In the issues tab you just need to click on the Create Issue button and describe the bug/feature.

do we wait for Tim to review it or do we let him know?

He will read the new issue you create 🤷‍♂️ and if you want his feedback you should @ him

alexandrevryghem avatar Oct 24 '22 16:10 alexandrevryghem

Very thanks @alexandrevryghem ,

I'd better wait until @tdonohue can read this part and tell me how I can help.

jtimal avatar Oct 24 '22 17:10 jtimal