package org.apache.lucene.index;

/**
 * Copyright 2004 The Apache Software Foundation
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import java.io.IOException;

import org.apache.lucene.store.GCJDirectory;

class GCJSegmentReader extends SegmentReader {

  public final TermDocs termDocs() throws IOException {
    if (directory() instanceof GCJDirectory) {
      return new GCJTermDocs(this);
    } else {
      return super.termDocs();
    }
  }
}

@@ -772,144 +772,496 @@
 %0A%0A  
-public final TermDocs termDocs() throws IOException %7B%0A    if (directory() instanceof GCJDirectory) %7B%0A      return new GCJTermDocs(this);
+/** Try to use an optimized native implementation of TermDocs.  The optimized%0A   * implementation can only be used when the segment's directory is a%0A   * GCJDirectory and it is not in compound format.  */%0A  public final TermDocs termDocs() throws IOException %7B%0A    if (directory() instanceof GCJDirectory       // it's a GCJ directory%0A        && this.cfsReader == null) %7B              // & not in compound format%0A      return new GCJTermDocs(this);               // so can use GCJTermDocs
 %0A   

Disable optimized implementation with compound format.