Skip to content
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

Relocate BinaryRange to avoid split package #77994

Closed
ChrisHegarty opened this issue Sep 20, 2021 · 3 comments
Closed

Relocate BinaryRange to avoid split package #77994

ChrisHegarty opened this issue Sep 20, 2021 · 3 comments
Labels
modularization Java Modules related needs:triage Requires assignment of a team area label

Comments

@ChrisHegarty
Copy link
Contributor

To allow for the future modularization of Elasticsearch with Java Modules, there are a number preparatory tasks that need be completed. This is one such task: eliminate split packages.

The ES class BinaryRange [1] is located in the org.apache.lucene.document package, which is shared (thus split at runtime) with Lucene-core. A split package, in this case between Elasticsearch-core and Lucene-core, will result in a configuration error at runtime when Elasticsearch-core is deployed as a module.

The BinaryRange class accesses the package-private RangeFieldQuery class, thus requiring it to be in the same runtime package. In a recent Lucene change [2][3], RangeFieldQuery has been made public, therefore BinaryRange no longer requires to be in the same runtime package as RangeFieldQuery. Moving BinaryRange to a non-lucene package will eliminate the split package issue mentioned above.

It would appear that BinaryRange is used exclusively by code in org.elasticsearch.perculator, so this package may be a reasonable place to relocate to.

Note: The recent changes mentioned in [2][3] are in Lucene 9.0, therefore this issue has a dependency on the Lucene 9.0 upgrade. relates #73324

[1] server/src/main/java/org/apache/lucene/document/BinaryRange.java
[2] https://issues.apache.org/jira/browse/LUCENE-9319
[3] apache/lucene@6a7131e#diff-21640bf6d91f5c652943fea9744baab7b2182ee0e9eeb10a4028292d93ddb655

@ChrisHegarty ChrisHegarty added needs:triage Requires assignment of a team area label modularization Java Modules related labels Sep 20, 2021
@romseygeek
Copy link
Contributor

There are a few classes in our source tree that re-use the org.apache.lucene package. Now would be a good time to go through and see if any of them require upstream changes (like making RangeFieldQuery public) before we can move them; if so then we can get them in before lucene 9 is released.

A quick grep gives me the following:

  • plugins/analysis-ukrainian/src/main/java/org/apache/lucene/analysis/uk/XUkrainianMorfologikAnalyzer.java
  • x-pack/plugin/spatial/src/test/java/org/apache/lucene/geo/XShapeTestUtil.java
  • x-pack/plugin/search-business-rules/src/main/java/org/apache/lucene/search/CappedScorer.java
  • x-pack/plugin/search-business-rules/src/main/java/org/apache/lucene/search/CappedScoreQuery.java
  • x-pack/plugin/search-business-rules/src/main/java/org/apache/lucene/search/CappedScoreWeight.java
  • server/src/main/java/org/apache/lucene/index/LazySoftDeletesDirectoryReaderWrapper.java
  • server/src/main/java/org/apache/lucene/document/BinaryRange.java
  • server/src/main/java/org/apache/lucene/index/OneMergeHelper.java
  • server/src/main/java/org/apache/lucene/search/uhighlight/BoundedBreakIteratorScanner.java
  • server/src/main/java/org/apache/lucene/search/uhighlight/Snippet.java
  • server/src/main/java/org/apache/lucene/search/grouping/CollapsingTopDocsCollector.java
  • server/src/main/java/org/apache/lucene/search/grouping/CollapsingDocValuesSource.java
  • server/src/main/java/org/apache/lucene/search/uhighlight/CustomPassageFormatter.java
  • server/src/main/java/org/apache/lucene/search/uhighlight/CustomUnifiedHighlighter.java
  • server/src/main/java/org/apache/lucene/search/uhighlight/CustomFieldHighlighter.java
  • server/src/main/java/org/apache/lucene/search/grouping/CollapseTopFieldDocs.java
  • server/src/main/java/org/apache/lucene/search/vectorhighlight/CustomFieldQuery.java
  • server/src/main/java/org/apache/lucene/index/ShuffleForcedMergePolicy.java
  • server/src/main/java/org/apache/lucene/util/CombinedBitSet.java
  • server/src/main/java/org/apache/lucene/queries/SpanMatchNoDocsQuery.java
  • server/src/main/java/org/apache/lucene/queries/BinaryDocValuesRangeQuery.java
  • server/src/main/java/org/apache/lucene/queries/BlendedTermQuery.java
  • server/src/main/java/org/apache/lucene/queryparser/classic/XQueryParser.java
  • server/src/main/java/org/apache/lucene/analysis/miscellaneous/DisableGraphAttribute.java
  • server/src/main/java/org/apache/lucene/analysis/miscellaneous/DuplicateByteSequenceSpotter.java
  • server/src/main/java/org/apache/lucene/analysis/miscellaneous/DuplicateSequenceAttributeImpl.java
  • server/src/main/java/org/apache/lucene/analysis/miscellaneous/DeDuplicatingTokenFilter.java
  • server/src/main/java/org/apache/lucene/analysis/miscellaneous/DuplicateSequenceAttribute.java
  • server/src/main/java/org/apache/lucene/analysis/miscellaneous/DisableGraphAttributeImpl.java

@ChrisHegarty
Copy link
Contributor Author

@romseygeek Thanks for listing these. I've taken a pass over all of them already, and there are a number of changes that could be made in Lucene to simplify relocating these. I'll coordinate this with you.

@ChrisHegarty
Copy link
Contributor Author

Closing this issue in favour of tracking the split packages at a higher level of granularity, see #78166

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
modularization Java Modules related needs:triage Requires assignment of a team area label
Projects
None yet
Development

No branches or pull requests

2 participants