mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-27 07:14:59 +00:00
fix ShardUtils#getElasticsearchDirectoryReader(...) to use FilterDirectoryReader#getDelegate()
This commit is contained in:
parent
ac2e0fd6a0
commit
50c345238b
@ -78,7 +78,11 @@ public final class ShardUtils {
|
||||
if (reader instanceof ElasticsearchDirectoryReader) {
|
||||
return (ElasticsearchDirectoryReader) reader;
|
||||
} else {
|
||||
return null; // lucene needs a getDelegate method on FilteredDirectoryReader - not a big deal here
|
||||
// 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.
|
||||
return getElasticsearchDirectoryReader(((FilterDirectoryReader) reader).getDelegate());
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
Loading…
x
Reference in New Issue
Block a user