This module creates several blocks to support searching. It also enables the use of Ajax with search blocks, facets, and search results.
Find a file
2023-09-26 13:09:03 -03:00
.github/workflows file in wrong spot. 2023-07-26 18:24:30 -04:00
config/schema Create advanced_search.schema.yml 2023-06-28 17:04:54 -04:00
css Run phpcs and phpcbf 2023-06-07 00:59:16 -04:00
docs Rename the screenshot file name 2021-12-09 10:27:05 -05:00
js Update advanced_search.form.js 2023-03-02 10:37:38 -05:00
src Case sensitive. 2023-09-26 13:09:03 -03:00
templates/facets Removed Include/Exclude facets option 2023-02-01 23:12:29 -05:00
advanced_search.info.yml Removed Include/Exclude facets option 2023-02-01 23:12:29 -05:00
advanced_search.libraries.yml Renamed the module's machine name from islandora_advanced_search to `advanced_search 2021-12-09 10:06:25 -05:00
advanced_search.links.menu.yml Change Advanced Search Admin menu item to Search section in /admin/config 2021-12-09 10:59:08 -05:00
advanced_search.module Run phpcs and phpcbf 2023-06-07 00:59:16 -04:00
advanced_search.routing.yml Renamed the module's machine name from islandora_advanced_search to `advanced_search 2021-12-09 10:06:25 -05:00
advanced_search.services.yml Add event subscriber. 2023-09-26 12:51:02 -03:00
composer.json Update composer.json 2023-06-07 14:34:44 -04:00
CONTRIBUTING.md Added islandora_advanced_search module. 2021-04-02 10:52:20 +01:00
LICENSE Added islandora_advanced_search module. 2021-04-02 10:52:20 +01:00
README.md Update README.md 2023-03-15 11:34:16 -04:00

Islandora Advanced Search

Introduction

The Advanced Search module provides keyword search, field search, boolean search, and search within collections and sub collections. It provides a pager UI component that allows the user to set the number of items to show, select sort criteria and display style (grid or list). It provides a global search block, which redirects the search query to a search page. It also enables the use of Ajax with views (powered by Solr), search blocks, facets, and search results.

image

Features and Advantages

The module provides Boolean search, enables you to use AND, OR or NOT options to helps expanding or narrowing your search parameters.

 

Standard Query Parser

The Extended DisMax (eDismax) Query Parser 

Use

If  Edimax is turned off in configuration, the “Standard Query Parser” is used.

Edismax is enabled by default, but can be turned off in configuration (/admin/config/search/advanced). 

Capacity

  • Search a content field
  • Search a content field
  • Search across all of the fields which are indexed to Solr in Search API configuration. 

Search

Content indexed into a string field

  • Search returns on an exact field match (case sensitive)

Content indexed into a full-text field

  • Search returns on single words or phrases (words in order), and is case insensitive. 

Content indexed into a string field

  • Search returns on an exact field match (case sensitive)

Content indexed into a full-text field

  • “Bounded” searches return exact phrase matches, replicating the standard query parser features.
  • Case insensitive
  • Support for word searching in any order.
  • Syntax for wildcards and other search features available (described in table below)

Use the following syntaxes (eDismax ONLY) to increase Search acuracy is provided below:

Operator

Usage

Example

AND

Narrow down your search to include results that contain both search terms

orientation AND games

OR

Broaden your search to include results that contain either search term

students OR undergraduates

NOT

Narrow your search by excluding certain words or phrases

orientation NOT games

Asterisk (*)

Replaces the asterisk with multiple characters. Use to search for multiple beginnings, middles, and endings of words.

librar* 


will include results like:

  • library
  • libraries
  • librarian

Question Mark (?)

Replaces the question mark with a single character. Use to search for multiple beginnings, middles, and endings of words.

?est


will include results like:

  • Test
  • Pest
  • West

Will not include:

  • Contest

Tilde (~)

Use to make your search fuzzy or search for synonyms and alternate spellings. 


Only works for Keyword search.

Shaun~


will include results like:

  • Shaun
  • Sean
  • Shawn

Quotation Marks (“”)

Use quotation marks to search for a specific word or phrase.

“alumni golf tournament”

 

Requirements

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, advanced_search requires the following drupal modules:

Installation

To download/enable just this module, use the following from the command line:

composer require islandora/islandora
drush en advanced_search

Configuration

You can set the following configuration at admin/config/islandora/advanced_search:

image

Configuring Solr

Please review Islandora Documentation before continuing. The following assumes you already have a working Solr and the Drupal Search API setup.

Click here to find more detail about eDismax Search in Drupal.

image

To support collection based searches you need to index the field_member_of for every repository item as well define a new field that captures the full hierarchy of field_member_of for each repository item.

Add a new Content solr field field_decedent_of to the solr index at admin/config/search/search-api/index/default_solr_index/fields.

image

Then under admin/config/search/search-api/index/default_solr_index/processors enable Index hierarchy and setup the new field to index the hierarchy.

image

image

The field can now be used limit a search to all the decedents of a given object.

N.B. You may have to re-index to make sure the field is populated.

Configure Views

The configuration of views is outside of the scope of this document, please read the Drupal Documentation, as well as the Search API Documentation.

Exposed Form

Solr views allow the user to configure an exposed form (optionally as a block). This form / block is different from the Advanced Search Block. This module does not make any changes to the form, but this form can cause the Advanced Search Block to not function if configured incorrectly.

The Advanced Search Block requires that if present the Exposed forms Exposed form style is set to Basic rather than Input Required. As Input Required will prevent any search from occurring unless the user puts an additional query in the Exposed form as well.

Form Style

That being said it will be typical that you require the following Relationships and Contextual Filters when setting up a search view to enable Collection Search searches.

image

Here a relationship is setup with Member Of field and we have two contextual filters:

  1. field_member_of (Direct decedents of the Entity)
  2. field_decedent_of (All decedents of the Entity)

Both of these filters are configured the exact same way.

image

These filters are toggled by the Advanced Search block to allow the search to include all decedents or just direct decedents (documented below).

Paging

The paging options specified here can have an affect on the pager block (documented below).

image

Sorting

Additional the fields listed as Sort Criteria as Exposed will be made available in the pager block (documented below).

image

Search Highlighting

  1. Add Search Excerpt to the Advanced Search View.

    • Navigate to /admin/structure/views/view/advanced_search. In the Fields section, click Add, then select Search Excerpt.'

    image

  2. Turn on Search API highlight processor

    • Navigate to /admin/config/search/search-api > Edit Index > Processors > Enable Highlight processor.

    image

    • At the bottom of the form, under Processor Settings > Highlight > Select Create excerpt.

    image

  3. Configure Solr Server.

    • Navigate to /admin/config/search/search-api > Edit Server > Configure Solr backend > Advanced > Select Retrieve highlighted snippets.

    image

Result Summary

In your view, in the Header section, clikc Add, then search and select for "Result summary".

image

Then, paste the following code to Display textarea in Configure Header: Global: Result summary

<div id="ajax-page-summary" class="pager__summary">Displaying @start - @end of @total</div>

image

Configure Blocks

For each block type:

  • Facet
  • Pager
  • 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:

image

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.

image

N.B. Be aware that the Search views Exposed Form can have an affect on the function of the Advanced Search Block. Please refer to that section to learn more.

Search Block (NEW)

To associate this simple search block to a Advanced Search Result Page view, you can select its machine name in the dropdown list. With that, this form will redirect to the view with search parameters.

You can also change the search form's appearance by changing the default label, placeholder text for the search text field, and search button.

image

Documentation

Further documentation for this module is available on the Islandora 8 documentation site.

Troubleshooting/Issues

Having problems or solved a problem? Check out the Islandora google groups for a solution.

Maintainers

Current maintainers:

Sponsors

  • LYRASIS

Development

If you would like to contribute, please get involved by attending our weekly Tech Call. We love to hear from you!

If you would like to contribute code to the project, you need to be covered by an Islandora Foundation Contributor License Agreement or Corporate Contributor License Agreement. Please see the Contributors pages on Islandora.ca for more information.

We recommend using the islandora-playbook to get started.

License

GPLv2