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
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:
.
Where under ‘Contains’, it will be listing the different options such as:
.
and to the right the option of adding new rows with more filters, such as ("+" sign):
.
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 offield_member_of
for each
repository item.
Where do I set field_member_of
?
Many thanks in advance for your help!
2
Answers
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
In my case the name of my 'content type' was 'Metadata Record'
Then in the Solr index page proceed to index the field; indexed it twice:
I still have things to figure out to make it work; however, this would be the response to this question.
You first need to enable the Search API and Search API Solr modules.
Once enabled, you can go to: <YOUR DRUPAL’S DOMAIN>/admin/config/search/search-api
Here you must create an indexing server using solr.
Once your server has been created, create an index. This index will belong to your server and in it you must select the types of content you want to index and also the fields of those same types of content.
Once everything is set up, just run the indexing job and you’re done!