Rules and patterns for implementing a Solr search module in Lutece 8. SolrIndexer interface, CDI auto-discovery, SolrItem dynamic fields, batch indexing, incremental updates via CDI events. Based on the forms-solr module pattern.
View on GitHubskills/lutece-solr-indexer/SKILL.md
February 5, 2026
Select agents to install to:
npx add-skill https://github.com/lutece-platform/lutece-dev-plugin-claude/blob/main/skills/lutece-solr-indexer/SKILL.md -a claude-code --skill lutece-solr-indexerInstallation paths:
.claude/skills/lutece-solr-indexer/# Lutece 8 Solr Indexer Module
> Before implementing a Solr indexer, consult `~/.lutece-references/lutece-search-module-forms-solr/` — the reference implementation. The main plugin is at `~/.lutece-references/lutece-search-plugin-solr/`.
## Architecture Overview
```
plugin-solr (provides framework — already deployed)
↓ auto-discovers via CDI
module-myentity-solr (@ApplicationScoped SolrIndexer)
↓ builds
SolrItem (core fields + dynamic fields)
↓ writes via
SolrIndexerService.write(Collection<SolrItem>)
↓ committed to
Solr Server (HTTP/2 client)
Incremental path:
Entity CRUD → CDI ResourceEvent
↓ observed by
SolrEventRessourceListener (plugin-solr, queues SolrIndexerAction in DB)
↓ processed by
SolrIndexerDaemon → calls indexer.getDocuments(id)
```
A module provides a `SolrIndexer` implementation. The plugin-solr framework handles server communication, daemon scheduling, and action queue management.
**CDI auto-discovery** — any `@ApplicationScoped` class implementing `SolrIndexer` is automatically registered:
```java
// Inside SolrIndexerService (plugin-solr)
CDI.current( ).select( SolrIndexer.class ).stream( ).toList( );
```
## Step 1 — Maven Module Setup
```xml
<parent>
<groupId>fr.paris.lutece.plugins</groupId>
<artifactId>lutece-search-module-myentity-solr</artifactId>
</parent>
<dependencies>
<dependency>
<groupId>fr.paris.lutece.plugins</groupId>
<artifactId>plugin-solr</artifactId>
<version>[5.0.0-SNAPSHOT,)</version>
<type>lutece-plugin</type>
</dependency>
<dependency>
<groupId>fr.paris.lutece.plugins</groupId>
<artifactId>plugin-myentity</artifactId>
<version>[X.0.0-SNAPSHOT,)</version>
<type>lutece-plugin</type>
</dependency>
</dependencies>
```
## Step 2 — SolrIndexer Implementation
```java
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
import jakarta.enterprise.inject.Instance;
import fr.paris.lute