geovistory/design-system

Improve fulltext search in entity explorer

Closed this issue · 1 comments

Problem

Search in geovistory.org for Girard Grégoire.
-> no result

And search in geovistory.org for Grégoire Girard.
-> finds one person

Desired behavior

Search for Girard Grégoire should find the same person as search for Grégoire Girard.

Solution

The code responsible for the search is here:

export const getTextFilter = (s: string) => s.trim().replace('*', ' ').split(' ').join('*');

The getTextFilter() function is called from different places.

The text filter generated by the function is using Lucene syntax included in SPARQL, as described here:

Change the filter string to be match the desired behavior.

Gaetan suggests that searching with unaccented letters (e instead of é for example...) can still find the right words like Gregoire for Grégoire.