Skip to content

Commit 3521813

Browse files
fix: Upgrade to Lucene 10.x and fix API compatibility for record types (#14)
* Initial plan * Fix Lucene 10.x API compatibility: use record accessor methods In Lucene 10.x, TotalHits, BooleanClause, and BoostQuery are now Java records. Direct field access and old getter methods must be replaced with record accessor methods: - TotalHits.value -> TotalHits.value() - BooleanClause.getQuery() -> BooleanClause.query() - BooleanClause.getOccur() -> BooleanClause.occur() - BoostQuery.getQuery() -> BoostQuery.query() - BoostQuery.getBoost() -> BoostQuery.boost() Fixes #7 Co-authored-by: unknowIfGuestInDream <[email protected]> * Update to Lucene 10.x and Eclipse 2024-12 - Update target-platform.target to use Eclipse 2024-12 and Orbit 2024-12 - Update MANIFEST.MF to require Lucene 10.0.0+ and Java 21 - Update feature.xml to require Lucene 10.0.0+ - Keep Lucene 10.x API changes (record accessor methods) Co-authored-by: unknowIfGuestInDream <[email protected]> * Improve JDK * feat: Improve target lucene * Revert to Lucene 9.x API: Eclipse Orbit doesn't have Lucene 10.x yet Lucene 10.x bundles are not available in Eclipse Orbit repositories yet. Reverting all changes back to use Lucene 9.x API which is what's available in Eclipse Orbit 2024-06. The original runtime error reported by users is likely caused by running Eclipse versions that bundle newer Lucene versions not yet officially supported in Orbit. Co-authored-by: unknowIfGuestInDream <[email protected]> * Upgrade to Lucene 10.x, JDK 21, and Eclipse 2025-03 - Update target-platform.target to Eclipse 2025-03 and Orbit 2025-03 - Update MANIFEST.MF to require Lucene 10.0.0+ and Java 21 - Update feature.xml to require Lucene 10.0.0+ - Update Java source files to use Lucene 10.x record accessor methods: - TotalHits.value -> TotalHits.value() - BooleanClause.getQuery() -> BooleanClause.query() - BooleanClause.getOccur() -> BooleanClause.occur() - BoostQuery.getQuery() -> BoostQuery.query() - BoostQuery.getBoost() -> BoostQuery.boost() - Update all workflow files to use Java 21 - Update Eclipse project settings for Java 21 - Update README to reflect new requirements Co-authored-by: unknowIfGuestInDream <[email protected]> * Fix BoostQuery API: use getQuery() and getBoost() instead of record accessors BoostQuery is not a record in Lucene 10.x, unlike TotalHits and BooleanClause. It still uses the traditional getter methods getQuery() and getBoost(). Co-authored-by: unknowIfGuestInDream <[email protected]> * build: Prepare for 1.1.0 --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: unknowIfGuestInDream <[email protected]> Co-authored-by: 梦里不知身是客 <[email protected]>
1 parent cac7616 commit 3521813

File tree

17 files changed

+41
-36
lines changed

17 files changed

+41
-36
lines changed

.github/workflows/artifact.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ jobs:
99
runs-on: ubuntu-latest
1010
steps:
1111
- uses: actions/checkout@v6
12-
- name: Set up JDK 17
12+
- name: Set up JDK 21
1313
uses: actions/setup-java@v5
1414
with:
15-
java-version: '17'
15+
java-version: '21'
1616
distribution: 'temurin'
1717
cache: maven
1818
- name: Set up Maven

.github/workflows/maven.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
# This workflow will build a Java project with Maven
2-
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
3-
41
name: Eclipse Tycho build with Maven
52

63
on:
@@ -15,7 +12,7 @@ jobs:
1512
fail-fast: false
1613
matrix:
1714
os: [ubuntu-latest, windows-latest, macos-latest]
18-
java: [ 17, 21 ]
15+
java: [ 21 ]
1916
runs-on: ${{ matrix.os }}
2017

2118
steps:

.github/workflows/release-build-upload.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ jobs:
1313
uses: actions/checkout@v6
1414

1515
# 根据你的项目类型选择合适的构建工具,比如 Maven/Gradle/npm
16-
- name: Set up JDK 17
16+
- name: Set up JDK 21
1717
uses: actions/setup-java@v5
1818
with:
1919
distribution: 'temurin'
20-
java-version: '17'
20+
java-version: '21'
2121
- name: Set up Maven
2222
uses: stCarolas/setup-maven@v5
2323
with:

.github/workflows/update-site.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ jobs:
1111
- name: Checkout repository
1212
uses: actions/checkout@v6
1313

14-
- name: Set up JDK 17
14+
- name: Set up JDK 21
1515
uses: actions/setup-java@v5
1616
with:
1717
distribution: temurin
18-
java-version: 17
18+
java-version: 21
1919

2020
- name: Import GPG key
2121
env:

README.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,14 @@ InstaSearch is an Eclipse IDE plug-in for performing quick and advanced search o
44

55
Each file then can be previewed using few most matching and relevant lines. A double-click on the match leads to the matching line in the file.
66

7-
Now Support Eclipse 2024-06 and later, Mac OS X, Linux (with nautilus) and Windows.
7+
Because Eclipse 2024-06 through 2024-12 are built on Apache Lucene 9.10.0 or later,
8+
plugin version 1.0.0 provides initial support for this Lucene version range.
9+
* Apache Lucene 9.10.0+
10+
* JDK 17
11+
12+
Starting from version 1.1.0, the plugin supports Eclipse 2025-03 and later, and upgrades its dependency to Apache Lucene 10.0.0 or later.
13+
* Apache Lucene 10.0.0+
14+
* JDK 21
815

916
## Use
1017

@@ -70,7 +77,8 @@ mvn clean org.eclipse.tycho:tycho-versions-plugin:set-version -DnewVersion=2.0.0
7077

7178
## Install
7279

73-
1. Add `https://raw.githubusercontent.com/tlcsdm/eclipse-instasearch/update_site/` as the upgrade location in Eclipse.
80+
1. For Eclipse 2024-06 ~ 2024-12, add `https://raw.githubusercontent.com/tlcsdm/eclipse-instasearch/update_site_2024/` as the upgrade location in Eclipse.
81+
For Eclipse 2025-03 and later, add `https://raw.githubusercontent.com/tlcsdm/eclipse-instasearch/update_site/` as the upgrade location in Eclipse.
7482
2. Download from [Jenkins](https://jenkins.tlcsdm.com/job/eclipse-plugin/job/eclipse-instasearch)
7583
3. <table style="border: none;">
7684
<tbody>

features/com.tlcsdm.eclipse.instasearch.feature/feature.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<feature
33
id="com.tlcsdm.eclipse.instasearch.feature"
44
label="%featureName"
5-
version="1.0.0.qualifier"
5+
version="1.1.0.qualifier"
66
provider-name="%providerName"
77
plugin="com.tlcsdm.eclipse.instasearch">
88

@@ -303,16 +303,16 @@ version(s), and exceptions or additional permissions here}.&quot;
303303
<requires>
304304
<import plugin="org.eclipse.core.runtime" version="3.5.0" match="greaterOrEqual"/>
305305
<import plugin="org.eclipse.ui" version="3.5.0" match="greaterOrEqual"/>
306-
<import plugin="org.apache.lucene.core" version="9.10.0" match="greaterOrEqual"/>
307-
<import plugin="org.apache.lucene.analysis-common" version="9.10.0" match="greaterOrEqual"/>
306+
<import plugin="org.apache.lucene.core" version="10.0.0" match="greaterOrEqual"/>
307+
<import plugin="org.apache.lucene.analysis-common" version="10.0.0" match="greaterOrEqual"/>
308308
<import plugin="org.eclipse.ui.ide"/>
309309
<import plugin="org.eclipse.ui.editors"/>
310310
<import plugin="org.eclipse.ui.workbench.texteditor"/>
311311
<import plugin="org.eclipse.core.resources"/>
312312
<import plugin="org.eclipse.search"/>
313313
<import plugin="org.eclipse.jface.text"/>
314314
<import plugin="org.eclipse.debug.ui"/>
315-
<import plugin="org.apache.lucene.queryparser" version="9.10.0" match="greaterOrEqual"/>
315+
<import plugin="org.apache.lucene.queryparser" version="10.0.0" match="greaterOrEqual"/>
316316
<import plugin="org.apache.commons.lang3"/>
317317
</requires>
318318

plugins/com.tlcsdm.eclipse.instasearch/.classpath

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<classpath>
3-
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17"/>
3+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-21"/>
44
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
55
<classpathentry kind="src" path="src"/>
66
<classpathentry kind="output" path="bin"/>
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
eclipse.preferences.version=1
22
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
3-
org.eclipse.jdt.core.compiler.codegen.targetPlatform=17
4-
org.eclipse.jdt.core.compiler.compliance=17
3+
org.eclipse.jdt.core.compiler.codegen.targetPlatform=21
4+
org.eclipse.jdt.core.compiler.compliance=21
55
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
66
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
77
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
88
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
99
org.eclipse.jdt.core.compiler.release=enabled
10-
org.eclipse.jdt.core.compiler.source=17
10+
org.eclipse.jdt.core.compiler.source=21

plugins/com.tlcsdm.eclipse.instasearch/META-INF/MANIFEST.MF

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ Bundle-ManifestVersion: 2
33
Automatic-Module-Name: com.tlcsdm.eclipse.instasearch
44
Bundle-Name: %pluginName
55
Bundle-SymbolicName: com.tlcsdm.eclipse.instasearch;singleton:=true
6-
Bundle-Version: 1.0.0.qualifier
6+
Bundle-Version: 1.1.0.qualifier
77
Bundle-Activator: com.tlcsdm.eclipse.instasearch.InstaSearchPlugin
88
Bundle-Vendor: %providerName
99
Require-Bundle: org.eclipse.ui,
10-
org.apache.lucene.core;bundle-version="[9.10.0,1000.0.0)",
11-
org.apache.lucene.analysis-common;bundle-version="[9.10.0,1000.0.0)",
12-
org.apache.lucene.queryparser;bundle-version="[9.10.0,1000.0.0)",
10+
org.apache.lucene.core;bundle-version="[10.0.0,1000.0.0)",
11+
org.apache.lucene.analysis-common;bundle-version="[10.0.0,1000.0.0)",
12+
org.apache.lucene.queryparser;bundle-version="[10.0.0,1000.0.0)",
1313
org.apache.commons.lang3,
1414
org.eclipse.ui.ide,
1515
org.eclipse.ui.editors,
@@ -24,5 +24,5 @@ Require-Bundle: org.eclipse.ui,
2424
org.junit;resolution:=optional
2525
Bundle-ActivationPolicy: lazy
2626
Bundle-Localization: plugin
27-
Bundle-RequiredExecutionEnvironment: JavaSE-17
27+
Bundle-RequiredExecutionEnvironment: JavaSE-21
2828
Bundle-DocURL: https://github.com/tlcsdm/eclipse-instasearch

plugins/com.tlcsdm.eclipse.instasearch/src/com/tlcsdm/eclipse/instasearch/indexing/Searcher.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ private SearchResult collectSearchResults(SearchQuery searchQuery, IndexSearcher
169169
// Use IndexSearcher.search to get TopDocs
170170
TopDocs topDocs = indexSearcher.search(query, maxResults);
171171

172-
if (topDocs.totalHits.value == 0)
172+
if (topDocs.totalHits.value() == 0)
173173
return null;
174174

175175
ScoreDoc[] hits = topDocs.scoreDocs;

0 commit comments

Comments
 (0)