-
Notifications
You must be signed in to change notification settings - Fork 608
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
SOLR-16442: upgrade to Lucene 9.4 (do and document) #1056
Changes from 11 commits
b95a32a
5c991e6
47ce4ef
5103150
9f73dbd
6539a45
ca2895b
46c7d3b
a07738f
6368948
119f03a
3685857
213ec64
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
<!-- | ||
Licensed to the Apache Software Foundation (ASF) under one or more | ||
contributor license agreements. See the NOTICE file distributed with | ||
this work for additional information regarding copyright ownership. | ||
The ASF licenses this file to You under the Apache License, Version 2.0 | ||
the "License"); you may not use this file except in compliance with | ||
the License. You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
--> | ||
|
||
# Lucene upgrade steps | ||
|
||
## Start | ||
|
||
Create a new branch locally e.g. `git checkout -b lucene940 -t origin/main` for upgrading to Lucene 9.4.0 version. | ||
|
||
## Build | ||
|
||
### `versions.props` update | ||
|
||
``` | ||
- org.apache.lucene:*=9.3.0 | ||
+ org.apache.lucene:*=9.4.0 | ||
``` | ||
|
||
### `versions.lock` update | ||
|
||
``` | ||
gradlew --write-locks | ||
``` | ||
|
||
### `solr/licenses` update | ||
|
||
``` | ||
git rm lucene-*-9.3.0.jar.sha1 | ||
|
||
# ???manually get new .sha1 files??? | ||
|
||
git add lucene-*-9.4.0.jar.sha1 | ||
``` | ||
|
||
## Code | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Lets read upgrading notes provided by Lucene first; ehh? |
||
``` | ||
gradlew compileJava | ||
``` | ||
|
||
* adjust for signature changes e.g. | ||
* `int` to `long` type change | ||
* additional or removed constructor arguments | ||
* additional abstract base class or interface methods | ||
* inner classes becoming outer classes | ||
* codec changes (if any) | ||
* conceptually `s/org.apache.lucene.codecs.lucene9x.Lucene9x/org.apache.lucene.codecs.lucene94.Lucene94` | ||
|
||
## Test | ||
|
||
``` | ||
gradlew compileTestJava | ||
``` | ||
|
||
``` | ||
gradlew precommit | ||
``` | ||
|
||
``` | ||
gradlew test | ||
``` | ||
|
||
## Documentation | ||
|
||
### `solr/solr-ref-guide/antora.yml` update | ||
|
||
``` | ||
- lucene-javadocs: 'https://lucene.apache.org/core/9_3_0' | ||
+ lucene-javadocs: 'https://lucene.apache.org/core/9_4_0' | ||
``` | ||
|
||
## Finish | ||
|
||
Push the local branch to github (fork) and open a pull request. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,20 +37,20 @@ | |
* <li>unmap -- See {@link MMapDirectory#setUseUnmap(boolean)} | ||
* <li>preload -- See {@link MMapDirectory#setPreload(boolean)} | ||
* <li>maxChunkSize -- The Max chunk size. See {@link MMapDirectory#MMapDirectory(Path, | ||
* LockFactory, int)} | ||
* LockFactory, long)} | ||
* </ul> | ||
*/ | ||
public class MMapDirectoryFactory extends StandardDirectoryFactory { | ||
private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); | ||
boolean unmapHack; | ||
boolean preload; | ||
private int maxChunk; | ||
private long maxChunk; | ||
|
||
@Override | ||
public void init(NamedList<?> args) { | ||
super.init(args); | ||
SolrParams params = args.toSolrParams(); | ||
maxChunk = params.getInt("maxChunkSize", MMapDirectory.DEFAULT_MAX_CHUNK_SIZE); | ||
maxChunk = params.getLong("maxChunkSize", MMapDirectory.DEFAULT_MAX_CHUNK_SIZE); | ||
Comment on lines
-40
to
+53
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
if (maxChunk <= 0) { | ||
throw new IllegalArgumentException("maxChunk must be greater than 0"); | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,6 +25,7 @@ | |
import org.apache.lucene.index.IndexOptions; | ||
import org.apache.lucene.index.IndexableField; | ||
import org.apache.lucene.index.IndexableFieldType; | ||
import org.apache.lucene.index.VectorEncoding; | ||
import org.apache.lucene.index.VectorSimilarityFunction; | ||
import org.apache.lucene.search.SortField; | ||
import org.apache.solr.common.SolrException; | ||
|
@@ -548,6 +549,11 @@ public int vectorDimension() { | |
return 0; | ||
} | ||
|
||
@Override | ||
public VectorEncoding vectorEncoding() { | ||
return VectorEncoding.BYTE; | ||
} | ||
|
||
Comment on lines
+552
to
+556
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
@Override | ||
public VectorSimilarityFunction vectorSimilarityFunction() { | ||
return VectorSimilarityFunction.EUCLIDEAN; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -522,6 +522,7 @@ private static class ReaderWrapper extends FilterLeafReader { | |
fieldInfo.getPointIndexDimensionCount(), | ||
fieldInfo.getPointNumBytes(), | ||
fieldInfo.getVectorDimension(), | ||
fieldInfo.getVectorEncoding(), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
fieldInfo.getVectorSimilarityFunction(), | ||
fieldInfo.isSoftDeletesField()); | ||
newInfos.add(f); | ||
|
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
02fbd4e87241411fcf5d34e92a50bee46ab164dc |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
aa0f250558375922f3091820361156e514fe1842 |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
32eb1ad367ab1289804aeed95ea7216711a7764d |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
13e1ae2c760d8c0d7990ffe3296e46d9d8e6f842 |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
63661714be65f882a921d281965b0779fd487b90 |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
c0ca97d8f89e674084b44240d587453cf5df8670 |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
1034d876551fc21f7835b456dab01db21b9a4af6 |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
f704ee4b14e2fe2622bb983f04b36a32df8fd4a7 |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
a95ff17b51da6b3da641fa4053e5ee9ea2ff5daf |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
259863dfd107645de6146b3c87b4ecee66a4d43d |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
35fb746cbfc8a36264a2e6352294d8a45c9006fe |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
5c9d00dbe95e88980938f20be1e130070dd03b3a |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
cca1116f813c0f0c63acfac4c952baf29d46d76b |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
19749e264805171009836cbedecc5494b13cd920 |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
51bec1d5acc8ecaf9f50e047d3f86d60c7a958f4 |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
c8cf8c9308d8fb18a927c7ed267a14ace3990a5f |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
99b2d3c8e137a6853a2503456897d47d4f18974b |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
881cb214e79da14de35cb0e8e6779d2722828a96 |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
a126123e482e6bf2e7aea670d221a2a39d3277dc |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
fe74dbfe9dba9ee9ee2cb80f151fde97fb4efd12 |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
13f108a8572fcf0670c7df3ba8dbe1076d0e0dbe |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
e7a676a12ea50dcbf64564f4e4022f939f0a627d |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
84d956d1cb1458c51967af1c4acadd2a1f92634d |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
76887ca708f23b13613e45fb9e307c548b22c6da |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
406c9c539f262449d3b1e57e7bc4302efeecaf6c |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
5f13400741a511fd4ba48e64d5637fb0a8b1bd7a |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,9 +23,9 @@ | |
import org.apache.lucene.document.SortedDocValuesField; | ||
import org.apache.lucene.document.SortedSetDocValuesField; | ||
import org.apache.lucene.index.IndexableField; | ||
import org.apache.lucene.search.FieldComparator; | ||
import org.apache.lucene.search.FieldComparatorSource; | ||
import org.apache.lucene.search.SortField; | ||
import org.apache.lucene.search.comparators.TermOrdValComparator; | ||
Comment on lines
-26
to
+28
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
import org.apache.lucene.util.BytesRef; | ||
|
||
/** Custom field representing a {@link BinaryField} that's sortable. */ | ||
|
@@ -70,12 +70,14 @@ public BinarySortField(final String field, final boolean reverse) { | |
field, | ||
new FieldComparatorSource() { | ||
@Override | ||
public FieldComparator.TermOrdValComparator newComparator( | ||
public TermOrdValComparator newComparator( | ||
final String fieldname, | ||
final int numHits, | ||
final boolean enableSkipping, | ||
final boolean reversed) { | ||
return new FieldComparator.TermOrdValComparator(numHits, fieldname); | ||
final boolean sortMissingLast = false; | ||
return new TermOrdValComparator( | ||
numHits, fieldname, sortMissingLast, reversed, enableSkipping); | ||
} | ||
}, | ||
reverse); | ||
|
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.
./gradlew updateLicenses
will handle thisThere 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.
thanks! #1087 to simplify the docs (and I'll leave that PR open for a few days in case of additional documentation feedback)