The Islandora Solr Views module adds Islandora Solr as an option when creating or editing views with the Drupal Views module, helping facilitate the simple creation of Drupal structure objects that pull information from Islandora. It can be used to take the contents of Solr fields and expose them to the Views module, allowing administrators and editors to create pages, blocks, attachments and feeds based off of manipulated versions of those Solr fields. It can be used to design custom pages that list links to specific objects, or pages that allow users to run extremely specific, restricted searches without having access to the Solr search page itself. In short, anything one could do with Drupal Views - e.g. create pages that contain the OCR output of books, or create blocks with short at-a-glance lists of new objects added to a particular collection - can be done with Islandora's Solr index.
- A functioning, properly-indexed Islandora Solr Search installation
- Drupal Views module
- The Drupal Views UI module (part of the above Drupal Views module) should be enabled if you would like to create views from inside Drupal itself
Release Notes and Downloads
Upon enabling the Drupal Views, Drupal Views UI and Islandora Solr Search modules, the Views configuration screen should be available at http://path.to.your.site/admin/structure/views. From here, you can click 'Add new view' to start creating a Solr View.
On the next screen, enter a name for your view, and from the 'Show' drop-down menu, select 'Islandora Solr'. You can now click the 'Continue & Edit' button if you'd like to manipulate the view now, or 'Save & Exit' if you would like to edit it later.
From here, most of the configuration and setup for your view is exactly the same as for any other view, with a few significant differences. Islandora Solr Views adds Solr indices to the FIELDS, FILTER CRITERIA and SORT CRITERIA sections.
Tutorial: Creating a block that contains the latest objects in a collection
This tutorial assumes a fresh installation of Islandora with the default Solr and Gsearch setups, and that the Basic Image Solution Pack has been installed and contains images.
1. Create a new block view
When creating a new view, the option to add a page will be checked, and the option to add a block as well will be unchecked. Give the view a name, select 'Islandora Solr' from the Show drop-down menu, uncheck 'Create a page' and check 'Create a block'.
By default, a block will be created that contains no more than five items in an unformatted list. For this tutorial, these settings will be fine. Click 'Continue & Edit' to continue.
2. Remove the 'Islandora Solr: Score' field
Under 'Block details', you will see the basic settings for your block. By default, 'Islandora Solr: Score' is added as a field to new views. We will need to remove it. Click on it, and then click the 'Remove' button.
3. Add the 'dc.title' field to FIELDS
Titles of objects created with an XML form are given the 'dc.title' field. This is what we are going to want our block to display. Click the 'add' button beside the Fields section, and on the overlay that comes up, select 'Islandora Solr: dc.title' from the list. Click 'Apply (all displays)'.
For a small block, we probably don't want a label showing up for every object listed, so uncheck 'Create a label'. Check the 'Link field to object' button to make sure each object is being linked to from the block. Click 'Apply (all displays)' again to close the overlay.
4. Add the 'RELS_EXT_isMemberOfCollection_uri_ms' field to FILTER CRITERIA
We want our objects to be filtered from a certain collection. RELS-EXT datastreams define this collection with the format 'info:fedora/namespace:collection_pid'. In the case of a standard installation of Islandora, the Basic Image Solution Pack will have the RELS-EXT isMemberOfCollection_uri_ms field 'info:fedora/islandora:sp_basic_image_collection'. At any time, you can check a collection's namespace:collection_pid by clicking the 'Manage' tab on that collection, and then clicking the 'Datastreams' button. The collection's namespace:collection_pid will be above the list of datastreams.
Beside 'FILTER CRITERIA', click the 'add' button. Check off 'Islandora Solr: RELS_EXT_isMemberOfCOllection_uri_ms' from the list, and click 'Apply (all displays)'. On the next screen, under the 'RELS_EXT_isMemberOfCOllection_uri_ms' field, add 'info:fedora/islandora:sp_basic_image_collection'. Click 'Apply (all displays)' again to close the overlay.
5. Add the 'fgs_createdDate_dt' field to SORT CRITERIA
We would like to view only the latest objects created in our list, and if there are more than five objects total in the collection, we will need to have them sorted. The 'Islandora Solr: fgs_createdDate_dt' field will allow us to display only the five latest objects in our list.
Beside 'SORT CRITERIA', click the 'add' button. Check off 'Islandora Solr: fgs_createdDate_dt' from the list, and click 'Apply (all displays)'.
In order for the latest objects to show up on the top, we will need to sort them 'descending' instead of 'ascending', so on the next page, click the radio button beside 'Sort descending'. Click 'Apply (all displays)' again to close the overlay.
6. Save the block and add it to part of the structure
Click the 'Save' button at the top of the view editing page. This will add it to the list of blocks in your site's 'structure' section. You can add it to part of the structure by going to http://path.to.your.site/admin/structure/block, scrolling down to the 'Disabled' block section at the bottom, and adding it to one of the block regions.
Your new view will now show up in that region, listing all new images ingested into the Basic Image collection and providing links to those images. The below example is of a view block given the above setup, with the view name 'Image Feed', and a single image in that collection called 'Sample Image'.
The Islandora Solr Views module has no configuration options of its own, but pulls entries from the Solr index. Check the Islandora Solr Search section for more information on setting up Islandora Solr.