Skip to content

Apache Lucene open-source search software

Check the type of the IndexInput rather than the Directory to detect native implementation. This is a simpler and more correct test. It also permits the Directory to return a mixture of native and non-native IndexInput implementations.

Doug Cuttingb2416b30398f
diff --git a/src/gcj/org/apache/lucene/index/GCJSegmentReader.java b/src/gcj/org/apache/lucene/index/GCJSegmentReader.java
index b691bb7f7cb..d63dc1d3e89 100644
--- a/src/gcj/org/apache/lucene/index/GCJSegmentReader.java
+++ b/src/gcj/org/apache/lucene/index/GCJSegmentReader.java
@@ -18,7 +18,7 @@ package org.apache.lucene.index;
import java.io.IOException;
-import org.apache.lucene.store.GCJDirectory;
+import org.apache.lucene.store.GCJIndexInput;
class GCJSegmentReader extends SegmentReader {
@@ -26,8 +26,7 @@ class GCJSegmentReader extends SegmentReader {
* implementation can only be used when the segment's directory is a
* GCJDirectory and it is not in compound format. */
public final TermDocs termDocs() throws IOException {
- if (directory() instanceof GCJDirectory // it's a GCJ directory
- && this.cfsReader == null) { // & not in compound format
+ if (freqStream instanceof GCJIndexInput) { // it's a GCJIndexInput
return new GCJTermDocs(this); // so can use GCJTermDocs
} else {
return super.termDocs();