The H5P Content Search module provides Search API integration for H5P content. It extracts text from H5P JSON parameters and makes it searchable through Search API indexes.
The primary use case for this module is:
- Index H5P interactive content text for site-wide search
- Enable users to find H5P content based on embedded text
- Support multilingual H5P content searching
This module requires the following modules:
- Search API (https://www.drupal.org/project/search_api)
- H5P (https://www.drupal.org/project/h5p)
-
Install the module and its dependencies:
composer require drupal/search_api drush en search_api search_api_db h5p h5p_content_search -y
-
If Search API is not installed, install Search API Database module as well:
drush en search_api_db -y
- Navigate to Configuration → Search and metadata → Search API → Add server
- URL:
/admin/config/search/search-api/add-server
- URL:
- Fill in the form:
- Server name:
Database Server(or any name you prefer) - Machine name:
database_server(auto-generated) - Backend: Select Database
- Database: Leave as default (your Drupal database)
- Server name:
- Click Save
- Navigate to Configuration → Search and metadata → Search API → Add index
- URL:
/admin/config/search/search-api/add-index
- URL:
- Fill in the form:
- Index name:
Content Index(or any name you prefer) - Machine name:
content_index(auto-generated) - Datasources: Check Content (this indexes nodes)
- Expand "Content" and select the content types that have H5P fields
- Server: Select Database Server (the server you just created)
- Index name:
- Click Save
- After saving the index, you'll be on the index edit page
- Click the Processors tab
- URL:
/admin/config/search/search-api/index/content_index/processors
- URL:
- Scroll down and find H5P Text Extractor
- Check the box to enable it
- Scroll to the bottom and click Save
Important: You must complete Step 3 (enable the processor) first. The field only appears after the processor is enabled.
- Click the Fields tab on your index
- URL:
/admin/config/search/search-api/index/content_index/fields
- URL:
- Click Add fields button
- Scroll down past the "General" and "Content" sections to find the processor-provided fields section
- Find and check H5P Extracted Text (machine name:
h5p_extracted_text) - Click Add fields button at the bottom
- Back on the Fields page, configure the field:
- Find H5P Extracted Text in the list
- Set Type to Fulltext
- Set Boost to
1.0(or higher if you want H5P content prioritized)
- Click Save changes
- Click the View tab on your index
- URL:
/admin/config/search/search-api/index/content_index
- URL:
- You'll see indexing status (e.g., "0 of 10 items indexed")
- Click Index now button
- Wait for indexing to complete
- Refresh the page to verify all items are indexed
Search API doesn't include a search page by default. Choose one of these options:
Option A: Create a Search View (Recommended)
- Go to Structure → Views → Add view
- In the Show dropdown, select "Index Content Index" (or "Index [your_index_name]")
- This is your Search API index, prefixed with "Index"
- Don't select "Content" or "H5P Content" - those are regular entity types
- Check Create a page and set a path like
/search - Save and edit the view
- Add an exposed Fulltext search filter so users can enter search queries
Option B: Use Search API Page module
composer require drupal/search_api_page
drush en search_api_page -yConfigure at: /admin/config/search/search-api-pages
- Navigate to your search page
- Search for text that appears inside your H5P content
- The content should now be discoverable
- Clear cache: Run
drush crafter any code changes - Re-index: Click "Clear all indexed data" then "Index now" to force a fresh index
- No H5P text appearing: Ensure your content type has at least one field of type
h5pwith content
- The module auto-detects all H5P fields on any entity — no configuration needed regardless of field name
- Supports multiple H5P fields on the same entity
- Supports multi-value H5P fields
- The module extracts text from the H5P
parametersJSON stored in the database - HTML tags are stripped from extracted text
- Very short strings (< 3 characters) are filtered out to avoid indexing noise