You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As a user, I would like to be able to select multiple options in the author facet category, and
I would like the search logic to be "OR", so I can select same author with the variation (Jane Doe or J. Doe or Jane M. Doe etc)
What we currently have
Search results are shown, with facets on left side column.
Can click on any "checkbox" (checkbox in quotes as its actually a link styled with fontawesome to appear like a checkbox) to narrow search results by Facet selection. Similar with limiting by Year, you can hit the "Limit" button.
Once facet item clicked, we sent a get request to backend and reload a fresh page
Fresh page has search results narrowed by facet item. Facets on side left panel have been rearranged, where selected facet is now first facet shown in list. For the selected facet it only shows the one selected item within facet which is now showing as a checked checkbox. Finally above the search results a "selected filter" button showing currently applied facets is shown. Clicking on this button removes the selected filter and refreshes the page showing the results without this facet being applied.
Same events happen above on mobile, only instead of a left sidebar, we have a "Filter results" button which pulls out a side tray:
Simplest solution to achieve what we want
Ultimately we simply just want to be able to select multiple items within the SAME facet. When we do this, these items will be applied as an "OR" query in SOLR.
How to achieve this? Let's use the Author Facet in our example here.
After clicking on a author, "Jane A. Doe" in the author facet, we need to render all the authors in the author facet and make them clickable again. We currently only showing the selected "Jane A. Doe" and hiding the rest.
When clicking on an additional author, say "Stephen A. Smith", we need update the results by "OR"ing these two authors together, while "AND"ing any other facets that have been applied. We will need to append "Stephen A. Smith" to the URL as an additional author facet.
Rails has a way to make these query params show up as an Array in the controller, which I'd recommend following. Which looks like we are already doing? For example the query param would look like this in ERA: facets[all_contributors_sim][]: Chopoidalo, Cindy which means by adding another author to it, facets[all_contributors_sim][]: Jane, Doe we get an array back such as params[:facets][:all_contributors_sim] => ["Chopoidalo, Cindy", "Jane, Doe"]. This should make things much easier for ourselves
We will most likely need to do some work here in the backend, such as jupiter/app/models/jupiter_core/search.rb as Trica mentioned above. We need to take this array and apply "OR" between each item within the array.
Results get updated accordingly by applied facet items. Facets items being applied need to be shown in left side panel accordingly. Applied facet buttons need to be updated to show multiple OR facet items.
Basically above is really not much different then how we currently doing "Subject / Keyword" with the exception that these are being applied as "AND" instead of "OR".
From the UI point of view though they are doing exactly what we want:
and query params are coming in as an Array:
We can select multiple of them within the same facet, however since they are being "AND", each item you select reduces the number of items and their counts. It should work like Newegg, where counts remain constant unless your "AND"ing with another facet.
Speaking with @mbarnett realized that showing all labels in a facet could number in the thousands. This is a problem because it impacts the performance and usability of the page (scroll to the bottom of the long page).
A possible workaround is a modal that paginates the facet so that users can preview all labels in that facet. Alternatively or complimentary, we could have a per facet 'Apply' button which would apply several clicks to select facets before refreshing the page and providing the relevant results.
For a first pass of this we are going to make 'OR' the default behaviour within a facet and 'AND' the behaviour between different facets. Super users can manipulate the url to achieve the query they desire.
## Context
As a user, I would like to be able to select multiple options in the author facet category, and
I would like the search logic to be "OR", so I can select same author with the variation (Jane Doe or J. Doe or Jane M. Doe etc)
Related to #1990
## What's New
The default behaviour within a facet is to 'OR' behind `:or_facets` feature flag
Original Goal
What we currently have
Same events happen above on mobile, only instead of a left sidebar, we have a "Filter results" button which pulls out a side tray:
Simplest solution to achieve what we want
Ultimately we simply just want to be able to select multiple items within the SAME facet. When we do this, these items will be applied as an "OR" query in SOLR.
How to achieve this? Let's use the Author Facet in our example here.
facets[all_contributors_sim][]: Chopoidalo, Cindy
which means by adding another author to it,facets[all_contributors_sim][]: Jane, Doe
we get an array back such asparams[:facets][:all_contributors_sim] => ["Chopoidalo, Cindy", "Jane, Doe"]
. This should make things much easier for ourselvesjupiter/app/models/jupiter_core/search.rb
as Trica mentioned above. We need to take this array and apply "OR" between each item within the array.Basically above is really not much different then how we currently doing "Subject / Keyword" with the exception that these are being applied as "AND" instead of "OR".
From the UI point of view though they are doing exactly what we want:
and query params are coming in as an Array:
We can select multiple of them within the same facet, however since they are being "AND", each item you select reduces the number of items and their counts. It should work like Newegg, where counts remain constant unless your "AND"ing with another facet.
Originally posted by @murny in #1261 (comment)
The text was updated successfully, but these errors were encountered: