Drupal 8/9 module provides a user interface for the Federated Search for multiple Drupal sites which index their content into a single shared Solr Core.
- Ajax Solr is the JavaScript library which provide web based user interface to Apache Solr. The module integrates the library into Drupal framework.
At Digital Scholarship Unit - UTSC Library, we have developed this module to support search and retrieval using a core that is shared by multiple individual Drupal sites. This allows us to have a federated search across Drupal sites where an end user can conduct a search and see relevant results from multiple sites.
- A Solr endpoint
- A shared Solr core which multisite sites indexing their contents into.
- Ajax Solr library as dependency library.
- At
/admin/config/search/search-api/index/YOUR_SOLR_INDEX/fields
in each of exhibit sites, setup with Search API fields with the sameMACHINE NAME
andTYPE
. For example:
Field | Machine Name | Type | In Solr |
---|---|---|---|
Thumbnail | thumbnail | String | ss_thumbnail |
Title | title | Fulltext | tm_title |
Description | description | Fulltext | tm_description |
URI (search_api_url) | url | String | sm_url |
Other optional fields to add... | ... | ... | ... |
- By Composer:
composer require digitalutsc/ajax_solr_search
- OR git clone this module to your modules directory (ie. web/modules/contrib) of your Drupal site:
git clone https://github.com/digitalutsc/drupal_ajax_solr_search.git
- Clone the dependency Ajax Solr library to Libraries directory (ie. drupal/web/libraries):
git clone https://github.com/digitalutsc/ajax-solr.git
- Enable the module.
- Visit
/admin/config/search/ajax_solr
, setting up with:- The URL for Search Results Page, default is
/federated-search
. - Select Solr field(s) to search against.
- Select Solr field(s) for Facets.
- Select Solr field for Year Range filter.
- Select Solr field(s) for Sort Criteria.
- When sorting ascending on a field, results without the field are displayed first. This can be configured by adding
sortMissingLast=true
to the field in the Solr schema. This property is false by default. - Note that sorting on Solr
string
fields is case-sensitive. Case-insensitive sorting can be done by modifying the Solr schema. - Sorting on multivalued fields is not supported.
- When sorting ascending on a field, results without the field are displayed first. This can be configured by adding
- Select 4 mandatory Solr fields for Search Result rows: Thumbnail, title, description, and URL. Other options field can also be added.
- The URL for Search Results Page, default is
Year Range and Sort Criteria Configuration
- Visit the search page at
/federated-search
. - Live demo: https://find.digital.utsc.utoronto.ca/federated-search
This module won't work if its Drupal site and Solr Endpoint don't have the same Hypertext Transfer Protocol (HTTP). It means that both of Drupal site and Solr endpoint must be either in https://
or http://
.