refactor: compile against the forked OpenSearch package and drop the opensearch jar - #3439
Open
marevol wants to merge 2 commits into
Open
refactor: compile against the forked OpenSearch package and drop the opensearch jar#3439marevol wants to merge 2 commits into
marevol wants to merge 2 commits into
Conversation
…client Fess shipped org.opensearch:opensearch (17.9 MB) purely for its request and response types and its query builders; it never runs a node. Those classes are now forked and pruned into org.codelibs.fesen.opensearch.* inside fesen-httpclient, so the dependency and its exclusion block go away and every org.opensearch import moves to the forked package. Apache Lucene stays as the real org.apache.lucene and now arrives through fesen-httpclient, which keeps all thirteen modules Fess resolved before. Fess's own org.codelibs.fess.opensearch.* (DBFlute/ESFlute output) is unrelated and untouched. Three things are not a plain rename: - QueryShardContext is deliberately absent from the fork, so QueryBuilder no longer declares toQuery and AbstractQueryBuilder no longer declares doToQuery. The overrides in KnnQueryBuilder, HybridQueryBuilder, StoredLtrQueryBuilder and DefaultQueryBuilder only threw UnsupportedOperationException or delegated, so they are removed along with the now-unused imports. These builders exist to be serialised to JSON, which is unaffected. KnnQueryBuilderTest's test_doToQuery_isUnsupported covered a method that no longer exists and goes with it. - The seeded Index Exporter job embeds a class name in its script body, so scheduled_job.bulk moves to org.codelibs.fesen.opensearch.index.query. QueryBuilders too. The startup reload is create-only, so an existing installation keeps its stale copy and needs a separate migration. - IndexingHelper.deleteDocumentByQuery and LanguageHelper.createScript are part of the plugin-facing API and now take and return forked types; the plugins that call them migrate separately. Removing the dependency drops opensearch-3.8.0.jar and its twelve siblings plus reactive-streams, 17.84 MiB off the resolved runtime classpath (229 jars to 215).
Removing org.opensearch:opensearch took SnakeYAML off the resolved classpath at 2.6 and left jackson-dataformat-yaml to supply 2.5 instead. ThemeManifest parses theme.yaml with SnakeYAML directly, so the version it gets should not be decided by an unrelated Jackson module: declare it, at the release it has been running. The log4j2 entry that silenced org.opensearch.bootstrap no longer names anything. The forked tree has no bootstrap package - the node runtime was cut - and the original jar is gone, so the logger cannot match. Remove it rather than leave a rule pointing at a package that does not exist. 7469 tests pass.
This was referenced Sep 13, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
fesen-httpclientnow carries the OpenSearch DTOs and query builders Fess needs underorg.codelibs.fesen.opensearch.*, pruned from 8,578 classes to 3,751. This drops theorg.opensearch:opensearchdependency and moves Fess onto them.WEB-INF/libgoes from 229 jars / 146,843,781 bytes to 215 jars / 135,178,555 bytes — 11.67 MiB off every distribution. The 17.09 MiB server jar and its twelve small siblings leave, along withreactive-streams;fesen-httpclientgrows from 0.44 MiB to 7.09 MiB. Noorg/opensearch/class remains anywhere in the distribution — all 219 jars were swept.All 13 Lucene modules stay at 10.5.0. The old exclusion block had been suppressing eight of them; the fork declares them directly, so they come back.
The change
264 files, 2,049 import lines. 142 of the 210 main files are checked-in ESFlute output, so 81% of the occurrences are generated code.
src/main/webapphas none. Fess's ownorg.codelibs.fess.opensearch.*package is untouched — the rewrite was anchored so it could not match it.Three things were not a rename:
QueryShardContextis gone from the fork — it was the bridge whose removal collapsedindex/mapper/**,index/fielddata/**andsearch/internal/**. Four classes overrode a method taking it:KnnQueryBuilder,HybridQueryBuilder,StoredLtrQueryBuilderandDefaultQueryBuilder. All four bodies threwUnsupportedOperationExceptionor delegated to one that did — these builders exist to be serialised to JSON, which still works — so the overrides are deleted.KnnQueryBuilderTest.test_doToQuery_isUnsupportedcalled the removed method and could not compile; it is the only test removed.org.opensearch.index.query.QueryBuildersin its script string. The seed is updated. See the upgrade note below.IndexingHelper.deleteDocumentByQuery(SearchEngineClient, QueryBuilder), its four protected siblings, andLanguageHelper.createScript(Map, String)returningScript. Five plugin repositories follow them and ship together.Two side effects of dropping the dependency, both fixed here:
ThemeManifestparsestheme.yamlwith it directly but never declared it — it was arriving through the opensearch jar, and without itjackson-dataformat-yamldecides the version. Now declared at the release it has been running.org.opensearch.bootstrapno longer names anything: the forked tree has no bootstrap package and the original jar is gone. Removed.error_prone_annotationsmoves 2.45.0 → 2.36.0. Annotations only, unused at runtime, left alone.Upgrade note for the persisted scheduled job
fess_config.scheduled_job/_id=index_exporteris reloaded at every webapp boot, but withOpType.CREATE, so an existing document conflicts and is skipped. The corrected seed therefore does not reach an upgraded installation, and Fess has no migration framework to hang a fix on.The exposure is small and loud: the job ships
available:falsewith an empty cron expression, so it never fires on its own. An administrator who had enabled it will see it fail with aScriptEngineExceptionin the job log rather than fail silently or corrupt anything. The fix is a one-line edit in Admin > Scheduler, replacing the package prefix. This is release-note material; rewriting the document at boot would silently overwrite a script an administrator may have customised.Verification
mvn clean packageand the full suite — 7,469 tests, 0 failures._nodes/statsparsed with all 30 sections populated. ZeroNoClassDefFoundError,ClassNotFoundException,NoSuchMethodErrororServiceConfigurationErroracross all 13 log files, and zero ERROR-level lines.The facet result is the one that matters most:
search/aggregationswas cut from 1,042 classes to 334, and aggregation response parsers are only exercised at runtime.Ordering
Requires codelibs/fesen-httpclient#43, codelibs/fess-suggest#98 and codelibs/fess-crawler#208 to be released first. The five plugin repositories that follow the core signatures above must be released with this, not after it.