From cb8d6912584ff5f26359e235520f3c684278e72c Mon Sep 17 00:00:00 2001 From: Michael McCandless Date: Wed, 22 Jun 2011 18:29:23 +0000 Subject: [PATCH] remove dup'd code git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1138571 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/lucene/index/MultiFields.java | 63 ++++--------------- 1 file changed, 11 insertions(+), 52 deletions(-) diff --git a/lucene/src/java/org/apache/lucene/index/MultiFields.java b/lucene/src/java/org/apache/lucene/index/MultiFields.java index 0e973f438a8..0b96061ec4a 100644 --- a/lucene/src/java/org/apache/lucene/index/MultiFields.java +++ b/lucene/src/java/org/apache/lucene/index/MultiFields.java @@ -18,15 +18,16 @@ package org.apache.lucene.index; */ import java.io.IOException; -import java.util.Map; -import java.util.List; import java.util.ArrayList; +import java.util.List; +import java.util.Map; import java.util.concurrent.ConcurrentHashMap; -import org.apache.lucene.util.ReaderUtil; -import org.apache.lucene.util.ReaderUtil.Gather; // for javadocs import org.apache.lucene.util.Bits; import org.apache.lucene.util.BytesRef; +import org.apache.lucene.util.MultiBits; +import org.apache.lucene.util.ReaderUtil.Gather; // for javadocs +import org.apache.lucene.util.ReaderUtil; /** * Exposes flex API, merged from flex API of sub-segments. @@ -99,49 +100,11 @@ public final class MultiFields extends Fields { } } - private static class MultiReaderBits implements Bits { - private final int[] starts; - private final IndexReader[] readers; - private final Bits[] delDocs; - - public MultiReaderBits(int[] starts, IndexReader[] readers) { - assert readers.length == starts.length-1; - this.starts = starts; - this.readers = readers; - delDocs = new Bits[readers.length]; - for(int i=0;i readers = new ArrayList(); + final List delDocs = new ArrayList(); final List starts = new ArrayList(); try { @@ -149,7 +112,7 @@ public final class MultiFields extends Fields { @Override protected void add(int base, IndexReader r) throws IOException { // record all delDocs, even if they are null - readers.add(r); + delDocs.add(r.getDeletedDocs()); starts.add(base); } }.run(); @@ -159,16 +122,12 @@ public final class MultiFields extends Fields { throw new RuntimeException(ioe); } - assert readers.size() > 0; - if (readers.size() == 1) { + assert delDocs.size() > 0; + if (delDocs.size() == 1) { // Only one actual sub reader -- optimize this case - result = readers.get(0).getDeletedDocs(); + result = delDocs.get(0); } else { - int[] startsArray = new int[starts.size()]; - for(int i=0;i