Skip to main content
Drupal is a registered trademark of Dries Buytaert
Release: OpenID Connect / OAuth client 3.0.0-alpha9 New alpha version released for module openid_connect (3.0.0-alpha9). Release: Opensolr Search 4.5.0 Minor update available for module opensolr_search (4.5.0). Release: Timelinr 1.0.1 Minor update available for module timelinr (1.0.1). Usage Milestone: Simplify Module simplify crossed 10,000 active installs. Usage Milestone: Views Reference Filter Module entityreference_filter crossed 10,000 active installs. Usage Milestone: Dropdown Language Module dropdown_language crossed 10,000 active installs. Usage Milestone: Paragraphs Browser Module paragraphs_browser crossed 10,000 active installs. Usage Milestone: OpenAPI Module openapi crossed 10,000 active installs. Usage Milestone: Decoupled Router Module decoupled_router crossed 10,000 active installs. Module Revived: Entityqueue Buttons 1.1.2 Module entityqueue_buttons updated after 8 months of inactivity (1.1.2).

Plain Search Index Filter

54 sites Security covered Drupal 10–11
View on drupal.org

This module provides a Twig filter that safely removes HTML tags from text, preventing words from merging together. It also offers options to preserve specific HTML tags and convert relative links to absolute URLs, making it ideal for cleaning up content for search indexes.

The Plain Search Index Filter module introduces a powerful Twig extension, strip_tags_safe, designed to enhance the rendering of search index results in Drupal by seamlessly removing unwanted HTML while preserving the spacing and integrity of text. This solution prevents word merging issues commonly seen with the standard striptags filter, making it ideal for ensuring clean, readable search results.

Features

  • Basic Functionality: The module provides a new Twig filter strip_tags_safe, which can be applied to render arrays and strings to remove all HTML tags while preventing the merging of adjacent words.
  • Unique Features: Unlike striptags, strip_tags_safe maintains spaces where HTML tags were, ensuring that words do not run together.
  • Use Cases: Ideal for sites where search indexes need clean text inputs free from HTML clutter, such as academic databases, corporate websites, and libraries.

New Features

Configuration Page

  • Added a settings page at Administration > Configuration > System > Plain Search Index Filter settings
  • Configure link now available on the Extend page for quick access

Allowed HTML Tags

  • New option to preserve specific HTML tags when stripping content
  • Add multiple tags using the "Add another tag" interface
  • Useful for keeping semantic markup like <a>, <strong>, <em> in indexed content

Convert Relative Links to Absolute URLs

  • New checkbox option to convert relative URLs to absolute
  • Converts href="https://www.drupal.org/path" and src="/path" attributes to include the full domain
  • Ideal for content being indexed by external search systems

Post-Installation

After installing the Plain Search Index Filter module:

  1. No additional configuration page is needed.
  2. Simply apply the strip_tags_safe filter within your Twig templates to sanitize output for search indexes or any other text display.
  3. Example usage in node--search-index.html.twig:
    {{% set renderContent %}
        {{ content }}
    {% endset %}
    {{ renderContent|strip_tags_safe }}
    

Additional Requirements

For more information about setting up your Search API index using rendered HTML see this page.

  • Search API: Complements search functionalities, particularly when creating custom search pages and indexes.

Similar projects

While the twig's |striptags filter performs a similar function, the Plain Search Index Filter module uniquely preserves text spacing and integrity, making it more suitable for professional and academic applications where text readability is crucial.

Depends on

Dependencies of the latest stable release

No dependencies recorded for this project.

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
3
Tracked since
Apr 2025
Latest release
7 months ago
Releases (12 mo)
1 ▼ from 2
Maintenance
Active

Release Timeline

Releases

Version Type Core Release date
1.1.0 Stable 10–11 Jan 28, 2026
1.0.0 Stable 10–11 Apr 4, 2025
1.0.x-dev Dev 10–11 Apr 2, 2025