LUCENE-2858: fix join module

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/branches/lucene2858@1237321 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Muir 2012-01-29 16:03:40 +00:00
parent 45c377007f
commit f38af41141
6 changed files with 16 additions and 15 deletions

View File

@ -17,8 +17,8 @@ package org.apache.lucene.search.join;
* limitations under the License. * limitations under the License.
*/ */
import org.apache.lucene.index.AtomicIndexReader.AtomicReaderContext;
import org.apache.lucene.index.DocTermOrds; import org.apache.lucene.index.DocTermOrds;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.TermsEnum; import org.apache.lucene.index.TermsEnum;
import org.apache.lucene.search.Collector; import org.apache.lucene.search.Collector;
import org.apache.lucene.search.FieldCache; import org.apache.lucene.search.FieldCache;
@ -94,9 +94,9 @@ abstract class TermsCollector extends Collector {
} while (chunk >= buffer.length); } while (chunk >= buffer.length);
} }
public void setNextReader(IndexReader.AtomicReaderContext context) throws IOException { public void setNextReader(AtomicReaderContext context) throws IOException {
docTermOrds = FieldCache.DEFAULT.getDocTermOrds(context.reader, field); docTermOrds = FieldCache.DEFAULT.getDocTermOrds(context.reader(), field);
docTermsEnum = docTermOrds.getOrdTermsEnum(context.reader); docTermsEnum = docTermOrds.getOrdTermsEnum(context.reader());
reuse = null; // LUCENE-3377 needs to be fixed first then this statement can be removed... reuse = null; // LUCENE-3377 needs to be fixed first then this statement can be removed...
} }
} }
@ -115,8 +115,8 @@ abstract class TermsCollector extends Collector {
collectorTerms.add(fromDocTerms.getTerm(doc, spare)); collectorTerms.add(fromDocTerms.getTerm(doc, spare));
} }
public void setNextReader(IndexReader.AtomicReaderContext context) throws IOException { public void setNextReader(AtomicReaderContext context) throws IOException {
fromDocTerms = FieldCache.DEFAULT.getTerms(context.reader, field); fromDocTerms = FieldCache.DEFAULT.getTerms(context.reader(), field);
} }
} }

View File

@ -22,7 +22,7 @@ import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import java.util.Set; import java.util.Set;
import org.apache.lucene.index.IndexReader.AtomicReaderContext; import org.apache.lucene.index.AtomicIndexReader.AtomicReaderContext;
import org.apache.lucene.index.IndexReader; import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.IndexWriter; // javadocs import org.apache.lucene.index.IndexWriter; // javadocs
import org.apache.lucene.index.Term; import org.apache.lucene.index.Term;
@ -120,7 +120,7 @@ public class ToChildBlockJoinQuery extends Query {
return null; return null;
} }
final DocIdSet parents = parentsFilter.getDocIdSet(readerContext, readerContext.reader.getLiveDocs()); final DocIdSet parents = parentsFilter.getDocIdSet(readerContext, readerContext.reader().getLiveDocs());
// TODO: once we do random-access filters we can // TODO: once we do random-access filters we can
// generalize this: // generalize this:
if (parents == null) { if (parents == null) {

View File

@ -24,7 +24,7 @@ import java.util.LinkedList;
import java.util.Map; import java.util.Map;
import java.util.Queue; import java.util.Queue;
import org.apache.lucene.index.IndexReader.AtomicReaderContext; import org.apache.lucene.index.AtomicIndexReader.AtomicReaderContext;
import org.apache.lucene.index.IndexReader; import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.IndexWriter; // javadocs import org.apache.lucene.index.IndexWriter; // javadocs
import org.apache.lucene.search.Collector; import org.apache.lucene.search.Collector;
@ -107,7 +107,7 @@ public class ToParentBlockJoinCollector extends Collector {
private int docBase; private int docBase;
private ToParentBlockJoinQuery.BlockJoinScorer[] joinScorers = new ToParentBlockJoinQuery.BlockJoinScorer[0]; private ToParentBlockJoinQuery.BlockJoinScorer[] joinScorers = new ToParentBlockJoinQuery.BlockJoinScorer[0];
private IndexReader.AtomicReaderContext currentReaderContext; private AtomicReaderContext currentReaderContext;
private Scorer scorer; private Scorer scorer;
private boolean queueFull; private boolean queueFull;

View File

@ -22,7 +22,7 @@ import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import java.util.Set; import java.util.Set;
import org.apache.lucene.index.IndexReader.AtomicReaderContext; import org.apache.lucene.index.AtomicIndexReader.AtomicReaderContext;
import org.apache.lucene.index.IndexReader; import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.IndexWriter; // javadocs import org.apache.lucene.index.IndexWriter; // javadocs
import org.apache.lucene.index.Term; import org.apache.lucene.index.Term;
@ -186,7 +186,7 @@ public class ToParentBlockJoinQuery extends Query {
return null; return null;
} }
final DocIdSet parents = parentsFilter.getDocIdSet(readerContext, readerContext.reader.getLiveDocs()); final DocIdSet parents = parentsFilter.getDocIdSet(readerContext, readerContext.reader().getLiveDocs());
// TODO: once we do random-access filters we can // TODO: once we do random-access filters we can
// generalize this: // generalize this:
if (parents == null) { if (parents == null) {

View File

@ -28,7 +28,7 @@ import org.apache.lucene.document.Field;
import org.apache.lucene.document.NumericField; import org.apache.lucene.document.NumericField;
import org.apache.lucene.document.StoredField; import org.apache.lucene.document.StoredField;
import org.apache.lucene.document.StringField; import org.apache.lucene.document.StringField;
import org.apache.lucene.index.IndexReader.AtomicReaderContext; import org.apache.lucene.index.AtomicIndexReader.AtomicReaderContext;
import org.apache.lucene.index.IndexReader; import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.LogDocMergePolicy; import org.apache.lucene.index.LogDocMergePolicy;
import org.apache.lucene.index.RandomIndexWriter; import org.apache.lucene.index.RandomIndexWriter;
@ -160,7 +160,7 @@ public class TestBlockJoin extends LuceneTestCase {
final int subIndex = ReaderUtil.subIndex(childDocID, leaves); final int subIndex = ReaderUtil.subIndex(childDocID, leaves);
final AtomicReaderContext leaf = leaves[subIndex]; final AtomicReaderContext leaf = leaves[subIndex];
final FixedBitSet bits = (FixedBitSet) parents.getDocIdSet(leaf, null); final FixedBitSet bits = (FixedBitSet) parents.getDocIdSet(leaf, null);
return leaf.reader.document(bits.nextSetBit(childDocID - leaf.docBase)); return leaf.reader().document(bits.nextSetBit(childDocID - leaf.docBase));
} }
public void testBoostBug() throws Exception { public void testBoostBug() throws Exception {

View File

@ -23,6 +23,7 @@ import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field; import org.apache.lucene.document.Field;
import org.apache.lucene.document.TextField; import org.apache.lucene.document.TextField;
import org.apache.lucene.index.*; import org.apache.lucene.index.*;
import org.apache.lucene.index.AtomicIndexReader.AtomicReaderContext;
import org.apache.lucene.search.*; import org.apache.lucene.search.*;
import org.apache.lucene.store.Directory; import org.apache.lucene.store.Directory;
import org.apache.lucene.util.BytesRef; import org.apache.lucene.util.BytesRef;
@ -184,7 +185,7 @@ public class TestJoinUtil extends LuceneTestCase {
actualResult.set(doc + docBase); actualResult.set(doc + docBase);
} }
public void setNextReader(IndexReader.AtomicReaderContext context) throws IOException { public void setNextReader(AtomicReaderContext context) throws IOException {
docBase = context.docBase; docBase = context.docBase;
} }