-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Docs and simplifications to support for Lucene ancient versions #124053
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
Docs and simplifications to support for Lucene ancient versions #124053
Conversation
|
Pinging @elastic/es-search-foundations (Team:Search Foundations) |
| throw new IllegalArgumentException(formatName); | ||
| } | ||
|
|
||
| private class FieldsWriter extends FieldsConsumer { |
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.
there is no need to have a FieldsWriter that throws exceptions, we can simply throw exception directly when a fields writer is currently requested, as that's only used for writing.
| * Holds all state required for {@link Lucene50PostingsReader} to produce a {@link | ||
| * org.apache.lucene.index.PostingsEnum} without re-seeking the terms dict. | ||
| */ | ||
| public static final class IntBlockTermState extends BlockTermState { |
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.
this is public, we can rely on the Lucene original variant where needed (only in tests with the removal of Lucene50PostingsReader)
The old lucene versions plugin allows users to read indices created by ancient Elasticsearch version, starting from 5.0. Especially for 5.x which relied on Lucene 6.x, some special logic is required around postings format support. That revolves around reading of FSTs, but has a consequence of requiring quite a few fork of other Lucene classes due to their visibility. This commit attempts to add javadocs to clarify the intent of some of these classes. It also includes some simplifications, in that Lucene50PostingsReader can be reused as-is and some other classes are only needed in tests hence are moved to the test folder.
f08c513 to
d56f308
Compare
|
@drempapis if it makes reviewing easier I can split this into a couple smaller PRs, let me know what you think. |
| */ | ||
| public abstract class LegacyAdaptingPerFieldPostingsFormat extends PostingsFormat { | ||
| @UpdateForV10(owner = UpdateForV10.Owner.SEARCH_FOUNDATIONS) | ||
| public final class LegacyAdaptingPerFieldPostingsFormat extends PostingsFormat { |
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.
this no longer needs to be abstract and subclassed, because the two only subclasses we had did exactly the same thing in their getPostingsFormat method:
if (formatName.equals("Lucene50")) {
return new BWCLucene50PostingsFormat();
} else {
return new BWCCodec.EmptyPostingsFormat();
}
This logic is now incorporated in this class.
| * </ul> | ||
| * </dl> | ||
| * This is a fork of {@link org.apache.lucene.backward_codecs.lucene50.Lucene50PostingsFormat} that allows to read from indices | ||
| * written by versions older than Lucene 7.0. |
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.
This is a good entry!
| public FieldsProducer fieldsProducer(SegmentReadState state) throws IOException { | ||
| PostingsReaderBase postingsReader = new Lucene50PostingsReader(state); | ||
| // The postings reader is the original one from Lucene 5.0 | ||
| PostingsReaderBase postingsReader = new org.apache.lucene.backward_codecs.lucene50.Lucene50PostingsReader(state); |
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.
Can't an import be used here? The xpack equivalent class has been deleted.
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.
yes I am not sure why I did not do so, fixing
drempapis
left a comment
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.
LGTM!
💚 Backport successful
|
…tic#124053) The old lucene versions plugin allows users to read indices created by ancient Elasticsearch version, starting from 5.0. Especially for 5.x which relied on Lucene 6.x, some special logic is required around postings format support. That revolves around reading of FSTs, but has a consequence of requiring quite a few fork of other Lucene classes due to their visibility. This commit attempts to add javadocs to clarify the intent of some of these classes. It also includes some simplifications, in that Lucene50PostingsReader can be reused as-is and some other classes are only needed in tests hence are moved to the test folder.
…#124053) (#124509) * Docs and simplifications to support for Lucene ancient versions (#124053) The old lucene versions plugin allows users to read indices created by ancient Elasticsearch version, starting from 5.0. Especially for 5.x which relied on Lucene 6.x, some special logic is required around postings format support. That revolves around reading of FSTs, but has a consequence of requiring quite a few fork of other Lucene classes due to their visibility. This commit attempts to add javadocs to clarify the intent of some of these classes. It also includes some simplifications, in that Lucene50PostingsReader can be reused as-is and some other classes are only needed in tests hence are moved to the test folder. * iter * iter
…tic#124053) The old lucene versions plugin allows users to read indices created by ancient Elasticsearch version, starting from 5.0. Especially for 5.x which relied on Lucene 6.x, some special logic is required around postings format support. That revolves around reading of FSTs, but has a consequence of requiring quite a few fork of other Lucene classes due to their visibility. This commit attempts to add javadocs to clarify the intent of some of these classes. It also includes some simplifications, in that Lucene50PostingsReader can be reused as-is and some other classes are only needed in tests hence are moved to the test folder.
…tic#124053) The old lucene versions plugin allows users to read indices created by ancient Elasticsearch version, starting from 5.0. Especially for 5.x which relied on Lucene 6.x, some special logic is required around postings format support. That revolves around reading of FSTs, but has a consequence of requiring quite a few fork of other Lucene classes due to their visibility. This commit attempts to add javadocs to clarify the intent of some of these classes. It also includes some simplifications, in that Lucene50PostingsReader can be reused as-is and some other classes are only needed in tests hence are moved to the test folder.
The old lucene versions plugin allows users to read indices created by ancient Elasticsearch version, starting from 5.0. Especially for 5.x which relied on Lucene 6.x, some special logic is required around postings format support. That revolves around reading of FSTs, but has a consequence of requiring quite a few fork of other Lucene classes due to their visibility.
This commit attempts to add javadocs to clarify the intent of some of these classes. It also includes some simplifications, in that Lucene50PostingsReader can be reused as-is and some other classes are only needed in tests hence are moved to the test folder.