Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Highlight search text in collection page results #513

Open
g-saracca opened this issue Oct 1, 2024 · 3 comments
Open

Highlight search text in collection page results #513

g-saracca opened this issue Oct 1, 2024 · 3 comments
Labels
SPA: Collection Page SPA UI Tasks related to the user interface (UI) or frontend development

Comments

@g-saracca
Copy link
Contributor

Highlight words within the cards displayed in the items of a collection when a search is performed.
It could be a good opportunity to use the mark html tag.

372247287-2ae3445b-3f92-4f9a-ad20-534a358e0928
@g-saracca g-saracca added UI Tasks related to the user interface (UI) or frontend development SPA: Collection Page SPA labels Oct 1, 2024
@pdurbin
Copy link
Member

pdurbin commented Oct 1, 2024

You should be able to pass show_relevance=true to get the highlights. See https://guides.dataverse.org/en/6.4/api/search.html

For example https://beta.dataverse.org/api/search?q=wine&show_relevance=true shows this:

'The classes are ordered and not balanced (e.g. there are much more normal <span class="search-term-match">wines</span> than excellent or poor ones).Your task is to predict the quality of <span class="search-term-match">wine</span> using the given data. '

@g-saracca
Copy link
Contributor Author

Hmm interesting, I'm not sure if the string/html response on matches objects will be used, but knowing the keys of the matching fields could be a very good help to know which fields on the cards need to have a highlighted word. Thanks @pdurbin !

@pdurbin
Copy link
Member

pdurbin commented Oct 1, 2024

Sure. We could, of course, improve the API if you'd like a different string/html response.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
SPA: Collection Page SPA UI Tasks related to the user interface (UI) or frontend development
Projects
Status: No status
Development

No branches or pull requests

2 participants