Islandora Advanced Search¶
- Configuring Solr
- Configure Collection Search
- Configure Views
- Collection Search
- Configure Facets
- Include / Exclude Facets
- Configure Blocks
- Advanced Search Block
Advanced Search adds additional functionality beyond the basic Solr search. It enables the use of Ajax with search blocks, facets, and search results.
Use composer to download the required libraries and modules.
composer require drupal/facets "^1.3" composer require drupal/search_api_solr "^4.1" composer require drupal/search_api "^1.5"
However, for reference,
islandora_advanced_search requires the following
To download/enable just this module, use the following from the command line:
composer require islandora/islandora drush en islandora_advanced_search
You can set the following configuration at Administration >> Configuration >> Advanced Search Settings (admin/config/search/advanced):
Please review Configure Search before continuing. The following assumes you already have a working Solr and the Drupal Search API setup.
Configure Collection Search¶
To support collection based searches you need to index the
every repository item as well define a new field that captures the full
field_member_of for each repository item.
Add a new
Content solr field
field_descendant_of to the solr index at
Index hierarchy and setup the new field to index the hierarchy.
The field can now be used limit a search to all the descendants of a given object.
You may have to re-index to make sure the field is populated.
It will be typical that you require the following Relationships and Contextual Filters when setting up a search view to enable Collection Search searches.
Here a relationship is setup with
Member Of field and we have two
field_member_of(Direct descendants of the Entity)
field_descendant_of(All descendants of the Entity)
Both of these filters are configured the exact same way.
These filters are toggled by the Advanced Search block to allow the search to include all descendants or just direct descendants (documented below).
The paging options specified here can have an affect on the pager block (documented below).
Additional the fields listed as Sort Criteria as Exposed will be made available in the pager block (documented below).
The facets can be configured at
admin/config/search/facets. Facets are linked
to a Source which is a Search API View Display so it will be typically
to have to duplicate your configuration for a given facet across each of the
displays where you want it to show up.
Include / Exclude Facets¶
To be able to display exclude facet links as well as include links in the facets block we have to duplicate the configuration for the facet like so.
Both the include / exclude facets must use the widget
List of links that allow the user to include / exclude facets
The excluded facet also needs the following settings to appear and function correctly.
The URL alias must match the same value as the include facet except it must be
~ character that is what links to the two facets to each other.
And it must also explicitly be set to exclude:
You may also want to enable Hide active items and Hide non-narrowing results for a cleaner presentation of facets.
For each block type:
- Advanced Search
There will be one block per View Display. The block should be limited to only appear when the view it was derived from is also being displayed on the same page.
This requires configuring the
visibility of the block as appropriate. For
collection based searches be sure to limit the display of the Facets block to
the models you want to display the search on, e.g:
Advanced Search Block¶
For any valid search field, you can drag / drop and reorder the fields to display in the advanced search form on. The configuration resides on the block so this can differ across views / displays if need be. Additionally if the View the block was derived from has multiple contextual filters you can choose which one corresponds to direct children, this will enable the recursive search checkbox.