A simple example plugin demonstrating how to create custom script engines for Fess, the open-source enterprise search server.
A Fess script engine turns a template plus a parameter map into a value. Fess uses script
engines wherever an administrator can enter a small script or expression — for example to compute a
document boost, derive a field value during crawling, or run logic in a scheduled job. The built-in
groovy engine evaluates full Groovy scripts; this example shows the minimal shape of a custom one.
This plugin provides a minimal implementation of a custom script engine for Fess. The ExampleEngine
serves as a template and starting point for developers who want to create their own script engines
with custom template processing logic.
- Real, Minimal Evaluation: Performs simple
${key}placeholder substitution from the parameter map - Idiomatic Structure: Demonstrates the standard structure of a Fess script engine
- Self-Registration: Registers itself with the script engine factory via the DI container
- Focused Tests: Meaningful tests covering substitution, missing keys, null/blank input, and factory lookup
The plugin extends Fess's AbstractScriptEngine class and implements:
- Template Evaluation (
evaluate): Substitutes${key}placeholders with values from the parameter map. A blank template returnsnull; a missing ornullvalue leaves the placeholder untouched. - Engine Identification (
getName): Provides the unique name ("example") used to register and look up the engine - DI Integration:
fess_se++.xmlregisters the engine into Fess'sscriptEngineFactoryat startup via aregisterpostConstruct (the++suffix means the fragment is additively merged into the corefess_se.xml)
- Fess 15.7.0 or later
- Java 21 or later
You can download the plugin JAR from Maven Central.
- Download the latest
fess-script-example-{version}.jarfrom the releases - Copy the JAR file to your Fess plugin directory (
$FESS_HOME/app/WEB-INF/plugin/) - Restart Fess server
- The "example" script engine will be available for use
For detailed installation instructions, see the Fess Plugin Guide.
There is no extra configuration to "use" the engine — the plugin self-registers via
fess_se++.xml when Fess starts. Once installed, the engine is available by its registered name,
example, anywhere Fess lets you pick a script type, including:
- Data store crawling — field-mapping scripts that compute index field values
- Document boost — boost expressions evaluated per document during crawling
- Scheduled jobs — jobs whose Script Type is set to an engine name
- Path mappings / replacements — value transformations that accept a script type
In those places, select or enter example as the script type and provide a template such as
Hello ${name}. Internally Fess resolves the engine through the factory:
ComponentUtil.getScriptEngineFactory().getScriptEngine("example").evaluate(template, paramMap);This example engine substitutes ${key} placeholders with values from the parameter map, which
makes it a useful starting point for learning the API and for building richer engines.
git clone https://github.com/codelibs/fess-script-example.git
cd fess-script-example
mvn clean packagemvn testThe test suite includes focused test cases covering:
- Placeholder substitution (single, multiple, and non-string values)
- Missing-key and null-value behavior (placeholder left untouched)
- Blank/null template handling (returns
null) - Engine name and factory registration/lookup by name
# Format code
mvn formatter:format
# Check license headers
mvn license:check
# Generate Javadoc
mvn javadoc:javadocsrc/
├── main/java/
│ └── org/codelibs/fess/script/example/
│ └── ExampleEngine.java # Script engine implementation (${key} substitution)
├── main/resources/
│ └── fess_se++.xml # DI fragment that registers the engine (additive merge)
└── test/
├── java/
│ └── org/codelibs/fess/script/example/
│ ├── ExampleEngineTest.java # Engine tests + factory lookup
│ └── UnitScriptTestCase.java # Minimal UTFlute test base for the plugin
└── resources/
└── test_app.xml # Test DI container (includes scriptEngineFactory)
This project serves as a template for creating custom script engines. To create your own:
- Fork this repository
- Rename the
ExampleEngineclass - Implement your custom template processing logic in the
evaluatemethod - Update the
getNamemethod to return your engine's unique identifier - Update the DI configuration in
fess_se++.xml - Add appropriate tests
- Fess Framework: Core search server functionality (provided scope)
- LastaFlute: Web application framework with DI container
- DBFlute: Database access framework
- OpenSearch: Search engine integration (provided scope)
- UTFlute: Testing framework for LastaFlute applications
We welcome contributions! Please feel free to submit issues, feature requests, or pull requests.
- Follow the existing code style and formatting
- Add comprehensive tests for new functionality
- Update documentation as needed
- Ensure all tests pass before submitting PRs
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
- Documentation: Fess Official Documentation
- Issues: GitHub Issues
- Community: Fess Community Forum
- Fess - The main Fess search server
- Fess Plugins - Other Fess plugins
Developed by CodeLibs Project