Version 1.2.0 adds a few helpful new features.
Features
- Added support for an initial search on load (@andersosthus in #392)
- Added batch actions and the new "shouldClearFilters" option (@JasonStoltz in #391)
- Added BooleanFacet component (@Jfelix61 and @brianearwood in #383)
Maintenance
- Updated to the latest App Search API client (@JasonStoltz in #384)
Details
Initial Search
You can now enable alwaysSearchOnInitialLoad to performance a search when the page loads without a user having to submit the search form:
<SearchProvider
config={{
alwaysSearchOnInitialLoad: true
}}
>
Batch actions and shouldClearFilters
option
Batch actions allow you to call multiple actions in a row without incurring multiple API requests:
setSearchTerm("park");
addFilter("states", "Alaska", "any");
addFilter("states", "California", "any");
As part of this change, we've also added support for a shouldClearFilters
flag, which lets you decide whether or not changing the current search term should clear out the current filter selections. The default previously was to always clear filters when the search term changes.
addFilter("states", "Alaska", "any");
addFilter("states", "California", "any");
setSearchTerm("park", { shouldClearFilters: false });
<SearchBoxContainer
shouldClearFilters={false}
/>
Both of these features are helpful in a case where you have a search form with a submit button. Typically in search experiences, filters are applied immediately upon selection. But in the case of something like an "Advanced Search" form, filters are all applied at once only when a submit button is pressed. Being able to batch all actions at once on form submit makes this possible in Search UI.
See #391 for more detail.
BooleanFacet
The BooleanFacet
is a new view for Facet
components to be used when you have simple boolean toggles. Imagine data fields on a restaurant search app... "Good for children", "Allows pets", "Open for dinner", etc.