Search code examples
drupaladvanced-search

Drupal - Advanced Search


My current environment is:

  • Drupal 10.2.5
  • PHP: 8.2.15
  • MySQL: 8.0.36
  • List search related modules installed:
    • search_api_solr >> Version: 4.3.3
    • search_api >> Version: 8.x-1.34
    • facets >> Version: 2.0.7
    • advanced_search >> Version: 2.0.1

My goal is to have and advanced search like the one below: with a search box and filters

enter image description here .

Where under the 'Title', it will contain a drop down list with all the different indexed fields that I would like to filter by, such as: enter image description here .

Where under 'Contains', it will be listing the different options such as: enter image description here .

and to the right the option of adding new rows with more filters, such as ("+" sign): enter image description here .

I've looked into the 'advanced search' module, and it looks like it offers something very similar to what I'm looking for.

I've read the 'advanced_search' documentation.

But I'm having a hard time implementing it.

The instruction under Configure Collection Search

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.

Where do I set field_member_of?

Many thanks in advance for your help!


Solution

  • A member from the Islandora community guided me. Here is what I needed to do. In the desired 'content type', I had to create a field -for convenience and consistency, name it "Member of" > machine name: "field_member_of". Here comes the key part, set it up as a Entity reference > Reference type: Content Content type: Repository Item enter image description here

    In my case the name of my 'content type' was 'Metadata Record' enter image description here

    Then in the Solr index page proceed to index the field; indexed it twice:

    1. the entire field
    2. drill down to get the title

    I still have things to figure out to make it work; however, this would be the response to this question.