Persistent Filters
Rules your visitors never see, applied to every search on your native search page: show only one kind of document, or keep one out.
Where: Configuration › Search and metadata › Opensolr Search › Filters tab (
/admin/config/search/opensolr/filters)Add a filter
- Mode: + Must Match (include only) keeps only what matches; - Must Not Match (exclude) drops what matches.
- Field: any field of your index, with its type in brackets.
- Value: the value to match.
- Click Add Filter. It applies to the next search. Active Filters lists them, each with Remove.
How a value matches
- The value is matched exactly, as written. On a text field of a single value, such as
content_typeoruri, the whole field must equal it. - Wildcards do not work. A
*is taken as a plain character, so*/admin/*matches nothing, even though the hint on the tab offers it. - On full-text fields, such as
titleortext, the value is searched as a phrase: the words, in that order.
Examples that work
| Mode | Field | Value | Effect |
|---|---|---|---|
| - Must Not Match | content_type | application/pdf | No PDFs in the results. |
| + Must Match | meta_detected_language | en | English documents only. |
| - Must Not Match | category | Basic page | Leaves out one content type, by its name. |
| - Must Not Match | uri | the full address of one page | Hides that page. |
To keep whole sections of your site out of search, leave their content types unticked on the Data Crawler and Data Ingestion tabs. To hide one page for every search from the results page itself, use EXCLUDE ALL in Query Elevation.
In Embeddable Search UI mode this tab only shows a note: filters are then set in the configuration of your index in Opensolr.