You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by "s1monw (via GitHub)" <gi...@apache.org> on 2023/11/23 15:19:27 UTC
[PR] Move MergeState.DocMap to a FunctionalInterface [lucene]
s1monw opened a new pull request, #12836:
URL: https://github.com/apache/lucene/pull/12836
This change converts MergeState to an interface to make use of lambda expressions.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org
Re: [PR] Move MergeState.DocMap to a FunctionalInterface [lucene]
Posted by "s1monw (via GitHub)" <gi...@apache.org>.
s1monw merged PR #12836:
URL: https://github.com/apache/lucene/pull/12836
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org
Re: [PR] Move MergeState.DocMap to a FunctionalInterface [lucene]
Posted by "s1monw (via GitHub)" <gi...@apache.org>.
s1monw commented on code in PR #12836:
URL: https://github.com/apache/lucene/pull/12836#discussion_r1403570681
##########
lucene/core/src/java/org/apache/lucene/index/IndexWriter.java:
##########
@@ -5237,13 +5234,10 @@ public int get(int docID) {
for (int i = 0; i < docMaps.length; ++i) {
MergeState.DocMap reorderDocMap = reorderDocMaps[i];
docMaps[i] =
- new MergeState.DocMap() {
- @Override
- public int get(int docID) {
- int reorderedDocId = reorderDocMap.get(docID);
- int compactedDocId = compactionDocMap.get(reorderedDocId);
- return compactedDocId;
- }
+ docID -> {
+ int reorderedDocId = reorderDocMap.get(docID);
+ int compactedDocId = compactionDocMap.get(reorderedDocId);
+ return compactedDocId;
Review Comment:
yeah I am a bit afraid of the boxing that would happen here but we can for sure remove the variables
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org
Re: [PR] Move MergeState.DocMap to a FunctionalInterface [lucene]
Posted by "jpountz (via GitHub)" <gi...@apache.org>.
jpountz commented on code in PR #12836:
URL: https://github.com/apache/lucene/pull/12836#discussion_r1403533598
##########
lucene/core/src/java/org/apache/lucene/index/IndexWriter.java:
##########
@@ -5237,13 +5234,10 @@ public int get(int docID) {
for (int i = 0; i < docMaps.length; ++i) {
MergeState.DocMap reorderDocMap = reorderDocMaps[i];
docMaps[i] =
- new MergeState.DocMap() {
- @Override
- public int get(int docID) {
- int reorderedDocId = reorderDocMap.get(docID);
- int compactedDocId = compactionDocMap.get(reorderedDocId);
- return compactedDocId;
- }
+ docID -> {
+ int reorderedDocId = reorderDocMap.get(docID);
+ int compactedDocId = compactionDocMap.get(reorderedDocId);
+ return compactedDocId;
Review Comment:
Seeing the above makes me want to write something along the lines of `(reorderDocMap::get).andThen(compactionDocMap::get)`. (Just food for thoughts, it might not actually be practical)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org