diff --git a/server/src/main/java/org/elasticsearch/common/lucene/index/OpenSearchDirectoryReader.java b/server/src/main/java/org/elasticsearch/common/lucene/index/OpenSearchDirectoryReader.java index 25246d1fe77..2590d037abf 100644 --- a/server/src/main/java/org/elasticsearch/common/lucene/index/OpenSearchDirectoryReader.java +++ b/server/src/main/java/org/elasticsearch/common/lucene/index/OpenSearchDirectoryReader.java @@ -29,7 +29,7 @@ import java.io.IOException; /** * A {@link org.apache.lucene.index.FilterDirectoryReader} that exposes - * Elasticsearch internal per shard / index information like the shard ID. + * OpenSearch internal per shard / index information like the shard ID. */ public final class OpenSearchDirectoryReader extends FilterDirectoryReader { @@ -63,7 +63,7 @@ public final class OpenSearchDirectoryReader extends FilterDirectoryReader { /** * Wraps the given reader in a {@link OpenSearchDirectoryReader} as - * well as all it's sub-readers in {@link ElasticsearchLeafReader} to + * well as all it's sub-readers in {@link OpenSearchLeafReader} to * expose the given shard Id. * * @param reader the reader to wrap @@ -80,7 +80,7 @@ public final class OpenSearchDirectoryReader extends FilterDirectoryReader { } @Override public LeafReader wrap(LeafReader reader) { - return new ElasticsearchLeafReader(reader, shardId); + return new OpenSearchLeafReader(reader, shardId); } } @@ -97,7 +97,7 @@ public final class OpenSearchDirectoryReader extends FilterDirectoryReader { OpenSearchDirectoryReader openSearchDirectoryReader = getOpenSearchDirectoryReader(reader); if (openSearchDirectoryReader == null) { throw new IllegalArgumentException( - "Can't install close listener reader is not an OpenSearchDirectoryReader/ElasticsearchLeafReader"); + "Can't install close listener reader is not an OpenSearchDirectoryReader/OpenSearchLeafReader"); } IndexReader.CacheHelper cacheHelper = openSearchDirectoryReader.getReaderCacheHelper(); if (cacheHelper == null) { @@ -120,7 +120,7 @@ public final class OpenSearchDirectoryReader extends FilterDirectoryReader { // We need to use FilterDirectoryReader#getDelegate and not FilterDirectoryReader#unwrap, because // If there are multiple levels of filtered leaf readers then with the unwrap() method it immediately // returns the most inner leaf reader and thus skipping of over any other filtered leaf reader that - // may be instance of ElasticsearchLeafReader. This can cause us to miss the shardId. + // may be instance of OpenSearchLeafReader. This can cause us to miss the shardId. return getOpenSearchDirectoryReader(((FilterDirectoryReader) reader).getDelegate()); } } diff --git a/server/src/main/java/org/elasticsearch/common/lucene/index/ElasticsearchLeafReader.java b/server/src/main/java/org/elasticsearch/common/lucene/index/OpenSearchLeafReader.java similarity index 78% rename from server/src/main/java/org/elasticsearch/common/lucene/index/ElasticsearchLeafReader.java rename to server/src/main/java/org/elasticsearch/common/lucene/index/OpenSearchLeafReader.java index 6d4b820797d..5605c56e113 100644 --- a/server/src/main/java/org/elasticsearch/common/lucene/index/ElasticsearchLeafReader.java +++ b/server/src/main/java/org/elasticsearch/common/lucene/index/OpenSearchLeafReader.java @@ -25,9 +25,9 @@ import org.elasticsearch.index.shard.ShardId; /** * A {@link org.apache.lucene.index.FilterLeafReader} that exposes - * Elasticsearch internal per shard / index information like the shard ID. + * OpenSearch internal per shard / index information like the shard ID. */ -public final class ElasticsearchLeafReader extends SequentialStoredFieldsLeafReader { +public final class OpenSearchLeafReader extends SequentialStoredFieldsLeafReader { private final ShardId shardId; @@ -37,7 +37,7 @@ public final class ElasticsearchLeafReader extends SequentialStoredFieldsLeafRea * * @param in specified base reader. */ - public ElasticsearchLeafReader(LeafReader in, ShardId shardId) { + public OpenSearchLeafReader(LeafReader in, ShardId shardId) { super(in); this.shardId = shardId; } @@ -59,16 +59,16 @@ public final class ElasticsearchLeafReader extends SequentialStoredFieldsLeafRea return in.getReaderCacheHelper(); } - public static ElasticsearchLeafReader getElasticsearchLeafReader(LeafReader reader) { + public static OpenSearchLeafReader getOpenSearchLeafReader(LeafReader reader) { if (reader instanceof FilterLeafReader) { - if (reader instanceof ElasticsearchLeafReader) { - return (ElasticsearchLeafReader) reader; + if (reader instanceof OpenSearchLeafReader) { + return (OpenSearchLeafReader) reader; } else { // We need to use FilterLeafReader#getDelegate and not FilterLeafReader#unwrap, because // If there are multiple levels of filtered leaf readers then with the unwrap() method it immediately // returns the most inner leaf reader and thus skipping of over any other filtered leaf reader that - // may be instance of ElasticsearchLeafReader. This can cause us to miss the shardId. - return getElasticsearchLeafReader(((FilterLeafReader) reader).getDelegate()); + // may be instance of OpenSearchLeafReader. This can cause us to miss the shardId. + return getOpenSearchLeafReader(((FilterLeafReader) reader).getDelegate()); } } return null; diff --git a/server/src/main/java/org/elasticsearch/index/shard/ShardUtils.java b/server/src/main/java/org/elasticsearch/index/shard/ShardUtils.java index 2c9085d41aa..ae8e7ec0d02 100644 --- a/server/src/main/java/org/elasticsearch/index/shard/ShardUtils.java +++ b/server/src/main/java/org/elasticsearch/index/shard/ShardUtils.java @@ -23,7 +23,7 @@ import org.apache.lucene.index.DirectoryReader; import org.apache.lucene.index.LeafReader; import org.elasticsearch.common.Nullable; import org.elasticsearch.common.lucene.index.OpenSearchDirectoryReader; -import org.elasticsearch.common.lucene.index.ElasticsearchLeafReader; +import org.elasticsearch.common.lucene.index.OpenSearchLeafReader; public final class ShardUtils { @@ -35,9 +35,9 @@ public final class ShardUtils { */ @Nullable public static ShardId extractShardId(LeafReader reader) { - final ElasticsearchLeafReader esReader = ElasticsearchLeafReader.getElasticsearchLeafReader(reader); + final OpenSearchLeafReader esReader = OpenSearchLeafReader.getOpenSearchLeafReader(reader); if (esReader != null) { - assert reader.getRefCount() > 0 : "ElasticsearchLeafReader is already closed"; + assert reader.getRefCount() > 0 : "OpenSearchLeafReader is already closed"; return esReader.shardId(); } return null; @@ -55,7 +55,4 @@ public final class ShardUtils { } throw new IllegalArgumentException("can't extract shard ID, can't unwrap OpenSearchDirectoryReader"); } - - - }