UIIN-2859: Fetch facets with the same query as Contributor records when the search is done by selecting browse result. #2454
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
When a user hits a contributor record from the list of Browse results and is redirected to the Search lookup, then the query
contributors.name==/string "%{query}"
is used to get the same number of records as pointed out in the clicked record. If a user performs a regular search in the Search lookup, the querycontributors.name="%{query}"
is used. But facets usecontributors.name="%{query}"
for both options, so the number of records didn't match the number displayed next to facet options. Facets should build a query using the same logic as the search.Extracted common logic into
getTemplateForSelectedFromBrowseRecord
and applied for both search and facets.Added
selectedBrowseResult
to the deps inuseEffect
of theuseFacets
hook to fetch facet options when the only change is theselectedBrowseResult
parameter. This takes place when a user hits a Browse contributor, is redirected to the Search lookup, and hits the search button again.Approach
Refs
Screenshots
2024-04-22_15h13_50.mp4