This project is not covered by Drupal’s security advisory policy.

Component Search

The Component Search module provides powerful search integration for the Component Field module, making component configurations and content fully searchable through both Drupal core search and Search API. Transform your component-driven website into a searchable knowledge base with intelligent content extraction, entity reference processing, and advanced relevance tuning.

Key Features

🔍 Dual Search Integration

Drupal Core Search: Automatically extracts and indexes component content in the standard search system with zero configuration required.

Search API Integration: Provides specialized processors for advanced search features including faceting, filtering, and custom relevance algorithms.

🧠 Intelligent Content Extraction

Automatically discovers and extracts searchable content from:

  • Rich Text Fields: Processes text_format fields with HTML stripping and format-aware handling
  • Entity References: Includes content from referenced nodes, media, and taxonomy terms
  • Complex Data: Intelligently parses JSON arrays, objects, and media library selections
  • Component Metadata: Indexes component types and configurations for technical searches

⚡ Performance Optimised

Smart Caching: Configurable extraction caching with automatic invalidation prevents duplicate processing.

Background Processing: Queue-based indexing system ensures content updates don't block user interactions.

Dynamic Batching: Automatically adjusts processing batch sizes based on content complexity.

Getting Started

Requirements

Requires the Component Field module for component discovery and field management. Compatible with Drupal 10.4+ and 11.x.

Quick Setup

1. Install and enable the module: drush en component_search

2. Configure settings at /admin/config/search/component-search

3. Rebuild search indexes for immediate indexing

Advanced Configuration

Component Type Weighting

Fine-tune search relevance by assigning weights to different component types:

  • Hero/Banner components: 2.5-3.0x weight (high visibility content)
  • Navigation components: 1.5-2.0x weight (structural importance)
  • Footer components: 0.5-1.0x weight (supplementary content)

Entity Reference Processing

Configure how deeply to follow entity references (up to 3 levels) and what content to extract from referenced entities. Includes automatic detection of node body fields, media alt text, and taxonomy descriptions.

Search API Processors

When using Search API, the module provides specialized processors:

Component Content Extractor: Creates separate search fields for regular content, title content, and entity references with configurable boost factors.

Component Type Processor: Indexes component types for faceted search and filtering, with automatic categorization and optional boolean fields for precise filtering.

Developer Features

Extensible Architecture

Built with extensibility in mind, providing services and hooks for custom functionality:

// Extract content programmatically
$extractor = \Drupal::service('component_search.content_extractor');
$content = $extractor->extractSearchableContent($entity);

// Handle custom entity changes
$manager = \Drupal::service('component_search.search_manager');
$manager->handleEntityChange($entity, 'update');

Custom Extraction Logic

Create custom extractors for specialized component types or implement component-specific processing rules through the flexible plugin system.

Performance & Scalability

Memory Management

Configurable content length limits, adaptive batch sizing, and reference depth controls prevent memory issues on large sites.

Caching Strategy

Multi-level caching system with automatic invalidation, TTL management, and size limits ensures optimal performance without stale data.

Background Processing

Queue-based processing system handles large-scale operations without blocking user interactions, with automatic retry and error recovery.

Content Types Supported

The module intelligently processes all component property types discovered by the Component Field module:

  • Text fields: Plain text, rich text (text_format), and textarea fields
  • References: Entity autocomplete, media library, and taxonomy term references
  • Structured data: JSON arrays, objects, and nested configurations
  • Media content: File metadata, alt text, and media entity properties

Use Cases

Component Libraries

Make your design system components discoverable by content editors and developers through comprehensive search functionality.

Content Management

Enable content managers to find pages containing specific component types or configurations for maintenance and auditing.

Site Search Enhancement

Improve public-facing search results by including rich component content that wouldn't otherwise be indexed.

Integration Examples

Faceted Search

Use with the Facets module to create component-type-based search filters, allowing users to find content by the components it contains.

Views Integration

Create Views that display entities based on their component content or types, perfect for content auditing and management interfaces.

Editorial Workflow

Integrate with editorial workflows to help content creators find and reuse existing component configurations.

Professional Support

The Component Search module is actively maintained and supported. Professional consulting and custom development services are available for enterprise implementations requiring specialised configuration or integration work.

Project information

Releases