mirror of https://github.com/apache/lucene.git
LUCENE-4298: MultiFields.getTermDocsEnum(Reader,Bits,String,BytesRef) did not work at all
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1371291 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
2c38158032
commit
858f4ed040
|
@ -16,6 +16,10 @@ Bug Fixes
|
|||
than 1 when overlap == maxOverlap (always the case for conjunctions),
|
||||
then the score would be incorrect. (Pascal Chollet, Robert Muir)
|
||||
|
||||
* LUCENE-4298: MultiFields.getTermDocsEnum(IndexReader, Bits, String, BytesRef)
|
||||
did not work at all, it would infinitely recurse.
|
||||
(Alberto Paro via Robert Muir)
|
||||
|
||||
======================= Lucene 4.0.0-BETA =======================
|
||||
|
||||
New features
|
||||
|
|
|
@ -125,7 +125,7 @@ public final class MultiFields extends Fields {
|
|||
* term. This will return null if the field or term does
|
||||
* not exist. */
|
||||
public static DocsEnum getTermDocsEnum(IndexReader r, Bits liveDocs, String field, BytesRef term) throws IOException {
|
||||
return getTermDocsEnum(r, liveDocs, field, term);
|
||||
return getTermDocsEnum(r, liveDocs, field, term, DocsEnum.FLAG_FREQS);
|
||||
}
|
||||
|
||||
/** Returns {@link DocsEnum} for the specified field &
|
||||
|
|
|
@ -169,4 +169,22 @@ public class TestMultiFields extends LuceneTestCase {
|
|||
r.close();
|
||||
dir.close();
|
||||
}
|
||||
|
||||
public void testTermDocsEnum() throws Exception {
|
||||
Directory dir = newDirectory();
|
||||
IndexWriter w = new IndexWriter(dir, newIndexWriterConfig( TEST_VERSION_CURRENT, new MockAnalyzer(random())));
|
||||
Document d = new Document();
|
||||
d.add(newStringField("f", "j", Field.Store.NO));
|
||||
w.addDocument(d);
|
||||
w.commit();
|
||||
w.addDocument(d);
|
||||
IndexReader r = w.getReader();
|
||||
w.close();
|
||||
DocsEnum de = MultiFields.getTermDocsEnum(r, null, "f", new BytesRef("j"));
|
||||
assertEquals(0, de.nextDoc());
|
||||
assertEquals(1, de.nextDoc());
|
||||
assertEquals(DocIdSetIterator.NO_MORE_DOCS, de.nextDoc());
|
||||
r.close();
|
||||
dir.close();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue