-
Notifications
You must be signed in to change notification settings - Fork 0
Enhance documentation and testing for ExampleEngine in Fess script plugin #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,15 +1,157 @@ | ||
| Example Script Plugin for Fess [](https://travis-ci.org/codelibs/fess-script-example) | ||
| ========================== | ||
| # Fess Script Example Plugin | ||
|
|
||
| [](https://maven-badges.herokuapp.com/maven-central/org.codelibs.fess/fess-script-example) | ||
| [](https://opensource.org/licenses/Apache-2.0) | ||
|
|
||
| A simple example plugin demonstrating how to create custom script engines for [Fess](https://fess.codelibs.org/), the open-source enterprise search server. | ||
|
|
||
| ## Overview | ||
|
|
||
| This is a example plugin for Fess Script. | ||
| 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. | ||
|
|
||
| ### Key Features | ||
|
|
||
| ## Download | ||
| - **Simple Implementation**: Demonstrates the basic structure of a Fess script engine | ||
| - **Template Pass-through**: Returns template strings unchanged (useful for testing and learning) | ||
| - **Full Integration**: Properly integrated with Fess's dependency injection container | ||
| - **Comprehensive Tests**: Includes extensive test cases covering edge cases and various scenarios | ||
|
|
||
| See [Maven Repository](https://repo1.maven.org/maven2/org/codelibs/fess/fess-script-example/). | ||
| ## Architecture | ||
|
|
||
| The plugin extends Fess's `AbstractScriptEngine` class and implements: | ||
|
|
||
| - **Template Evaluation**: Process template strings with parameter maps | ||
| - **Engine Identification**: Provides a unique name ("example") for the script engine | ||
| - **DI Integration**: Configured via LastaDi container for seamless Fess integration | ||
|
|
||
| ## Installation | ||
|
|
||
| See [Plugin](https://fess.codelibs.org/13.12/admin/plugin-guide.html) of Administration guide. | ||
| ### Prerequisites | ||
|
|
||
| - Fess 15.0.0 or later | ||
| - Java 21 or later | ||
|
|
||
| ### Download | ||
|
|
||
| You can download the plugin JAR from [Maven Central](https://repo1.maven.org/maven2/org/codelibs/fess/fess-script-example/). | ||
|
|
||
| ### Plugin Installation | ||
|
|
||
| 1. Download the latest `fess-script-example-{version}.jar` from the releases | ||
| 2. Copy the JAR file to your Fess plugin directory (`$FESS_HOME/app/WEB-INF/plugin/`) | ||
| 3. Restart Fess server | ||
| 4. The "example" script engine will be available for use | ||
|
|
||
| For detailed installation instructions, see the [Fess Plugin Guide](https://fess.codelibs.org/15.0/admin/plugin-guide.html). | ||
|
|
||
| ## Usage | ||
|
|
||
| Once installed, you can use the "example" script engine in your Fess configuration: | ||
|
|
||
| ```xml | ||
| <component name="exampleScriptEngine" class="org.codelibs.fess.script.example.ExampleEngine"/> | ||
| ``` | ||
|
|
||
| The engine will process templates by returning them unchanged, making it useful for: | ||
| - Testing script engine integration | ||
| - Learning how to implement custom script engines | ||
| - As a starting point for more complex implementations | ||
|
|
||
| ## Development | ||
|
|
||
| ### Building from Source | ||
|
|
||
| ```bash | ||
| git clone https://github.com/codelibs/fess-script-example.git | ||
| cd fess-script-example | ||
| mvn clean package | ||
| ``` | ||
|
|
||
| ### Running Tests | ||
|
|
||
| ```bash | ||
| mvn test | ||
| ``` | ||
|
|
||
| The test suite includes 19 comprehensive test cases covering: | ||
| - Basic functionality | ||
| - Edge cases (null/empty inputs) | ||
| - Various data types and special characters | ||
| - Multi-line templates and large content | ||
| - Instance independence and data integrity | ||
|
|
||
| ### Code Quality | ||
|
|
||
| ```bash | ||
| # Format code | ||
| mvn formatter:format | ||
|
|
||
| # Check license headers | ||
| mvn license:check | ||
|
|
||
| # Generate Javadoc | ||
| mvn javadoc:javadoc | ||
| ``` | ||
|
|
||
| ## Project Structure | ||
|
|
||
| ``` | ||
| src/ | ||
| ├── main/java/ | ||
| │ └── org/codelibs/fess/script/example/ | ||
| │ └── ExampleEngine.java # Main script engine implementation | ||
| ├── main/resources/ | ||
| │ └── fess_se++.xml # DI container configuration | ||
| └── test/java/ | ||
| └── org/codelibs/fess/script/example/ | ||
| └── ExampleEngineTest.java # Comprehensive test suite | ||
| ``` | ||
|
|
||
| ## Creating Your Own Script Engine | ||
|
|
||
| This project serves as a template for creating custom script engines. To create your own: | ||
|
|
||
| 1. Fork this repository | ||
| 2. Rename the `ExampleEngine` class | ||
| 3. Implement your custom template processing logic in the `evaluate` method | ||
| 4. Update the `getName` method to return your engine's unique identifier | ||
| 5. Update the DI configuration in `fess_se++.xml` | ||
| 6. Add appropriate tests | ||
|
|
||
| ## Dependencies | ||
|
|
||
| - **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 | ||
|
|
||
| ## Contributing | ||
|
|
||
| We welcome contributions! Please feel free to submit issues, feature requests, or pull requests. | ||
|
|
||
| ### Development Guidelines | ||
|
|
||
| - Follow the existing code style and formatting | ||
| - Add comprehensive tests for new functionality | ||
| - Update documentation as needed | ||
| - Ensure all tests pass before submitting PRs | ||
|
|
||
| ## License | ||
|
|
||
| This project is licensed under the Apache License 2.0 - see the [LICENSE](LICENSE) file for details. | ||
|
|
||
| ## Support | ||
|
|
||
| - **Documentation**: [Fess Official Documentation](https://fess.codelibs.org/) | ||
| - **Issues**: [GitHub Issues](https://github.com/codelibs/fess-script-example/issues) | ||
| - **Community**: [Fess Community Forum](https://discuss.codelibs.org/) | ||
|
|
||
| ## Related Projects | ||
|
|
||
| - [Fess](https://github.com/codelibs/fess) - The main Fess search server | ||
| - [Fess Plugins](https://github.com/codelibs?q=fess-) - Other Fess plugins | ||
|
|
||
| --- | ||
|
|
||
| Developed by [CodeLibs Project](https://github.com/codelibs) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The explicit constructor with super() call is redundant since Java provides a default no-argument constructor that calls super() automatically. Consider removing this constructor unless it serves a specific documentation purpose.