🔎 Configuring Search Filters
In MetacatUI, search filters are models that define a Solr field, values to use in a query for that field, and options for how to display the filter in the UI. Filters are used in the
CatalogSearchView and the
Filters which are combined to create a collection of data for a Portal can be built interactively using the
QueryBuilderView in the Portal Editor.
Custom search filters which users can use to subset a collection of portal data further can be designed and added to the portal in
FilterEditorView in the Portal Editor.
Filters that are displayed in the repository-level
CatalogSearchView are configured in the repository’s
config file. See the
Catalog Search View guide for more information.
The parts of a filter model
Filters are defined in the collections and portals XML schema repo. See the
FilterType to learn about the most essential parts of a filter model.
Filters are represented in MetacatUI by the
Filter model and all of it’s extended types.
Filters can be grouped to create nested queries such as
((field1:value1 OR field1:value2) AND field2:value3). They can also be grouped to display related filters together in the UI. See the
FilterGroup model for more information.
Custom Search Filters in Portals
This section gives information on how to configure the options that are available for users to create custom search filters in the
CustomFilterBuilderView in the Portal Editor.
How to hide a field from the custom filter builder
Add the Solr field name to
AppConfig.collectionQueryExcludeFields. This will also hide the field from the Query Builder.
Adding a new Solr field to the custom filter builder
When a new Solr field is added to the Solr schema, it will automatically get added to the
General, or default, category in the custom filter builder and it can be used with any filter type (free text, dropdown, year slider, etc). There are several places to configure the Solr field so that it works as intended:
QueryField.aliases(), add a human-readable alias for the field.
QueryField.descriptions(), add a short text description for the field.
- Add the field to the corresponding category in
- If this is a new Solr field
type, add the
typeto the array of the corresponding filter type in
QueryField.filterTypesMap(). If the new Solr field
typeis case-sensitive, add the
typeto the array in