Yes, lets do this. because the indexreader API says it WILL return null if there are no vectors.
On Tue, Feb 21, 2012 at 5:11 AM, Uwe Schindler <[email protected]> wrote: > There is another bug in ParallelAtomicReader with term vectors: It should > return null, if no vectors are available, but it returns an empty fields > instance instead. > > Fix is here: > > Index: lucene/core/src/java/org/apache/lucene/index/ParallelAtomicReader.java > =================================================================== > --- lucene/core/src/java/org/apache/lucene/index/ParallelAtomicReader.java > (revision 1291680) > +++ lucene/core/src/java/org/apache/lucene/index/ParallelAtomicReader.java > (working copy) > @@ -237,11 +237,14 @@ > @Override > public Fields getTermVectors(int docID) throws IOException { > ensureOpen(); > - ParallelFields fields = new ParallelFields(); > + ParallelFields fields = null; > for (Map.Entry<String,AtomicReader> ent : fieldToReader.entrySet()) { > String fieldName = ent.getKey(); > Terms vector = ent.getValue().getTermVector(docID, fieldName); > if (vector != null) { > + if (fields == null) { > + fields = new ParallelFields(); > + } > fields.addField(fieldName, vector); > } > } > > Committing... > > ----- > Uwe Schindler > H.-H.-Meier-Allee 63, D-28213 Bremen > http://www.thetaphi.de > eMail: [email protected] > > >> -----Original Message----- >> From: Robert Muir [mailto:[email protected]] >> Sent: Tuesday, February 21, 2012 10:58 AM >> To: [email protected] >> Subject: Re: [JENKINS] Lucene-trunk - Build # 1835 - Failure >> >> ok fieldToReader is used for other things, ill modify the patch to just not >> add to >> 'fields'. Thats what counts here. >> >> As far as the test, since its only doing a basic add of documents the "bogus" >> assert maybe should stay? >> I dont see any reason why its fieldsEnum should get fields with empty terms >> for >> this test, but at least ill add a comment. >> >> On Tue, Feb 21, 2012 at 4:49 AM, Robert Muir <[email protected]> wrote: >> > Both ParallelAtomicReader and this test are buggy in my opinion :) >> > >> > On one hand, the test should realize that fieldsEnum might return >> > fields where terms is null (FieldsEnum documents this!) >> > >> > On the other hand, ParallelAtomicReader shouldn't add non-indexed >> > fields into its map, because thats wasteful: >> > >> > Index: src/java/org/apache/lucene/index/ParallelAtomicReader.java >> > >> ================================================================ >> === >> > --- src/java/org/apache/lucene/index/ParallelAtomicReader.java >> > (revision >> > 1291672) >> > +++ src/java/org/apache/lucene/index/ParallelAtomicReader.java >> > +++ (working copy) >> > @@ -105,8 +105,10 @@ >> > // NOTE: first reader having a given field "wins": >> > if (!fieldToReader.containsKey(fieldInfo.name)) { >> > fieldInfos.add(fieldInfo); >> > - fieldToReader.put(fieldInfo.name, reader); >> > - this.fields.addField(fieldInfo.name, >> > reader.terms(fieldInfo.name)); >> > + if (fieldInfo.isIndexed) { >> > + fieldToReader.put(fieldInfo.name, reader); >> > + this.fields.addField(fieldInfo.name, >> > + reader.terms(fieldInfo.name)); >> > + } >> > } >> > } >> > } >> > >> > >> > >> > On Mon, Feb 20, 2012 at 11:30 PM, Apache Jenkins Server >> > <[email protected]> wrote: >> >> Build: https://builds.apache.org/job/Lucene-trunk/1835/ >> >> >> >> 1 tests failed. >> >> REGRESSION: >> >> org.apache.lucene.search.TestTermVectors.testKnownSetOfDocuments >> >> >> >> Error Message: >> >> null >> >> >> >> Stack Trace: >> >> junit.framework.AssertionFailedError >> >> at >> >> org.apache.lucene.util.LuceneTestCaseRunner.runChild(LuceneTestCaseRu >> >> nner.java:165) >> >> at >> >> org.apache.lucene.util.LuceneTestCaseRunner.runChild(LuceneTestCaseRu >> >> nner.java:57) >> >> at >> >> org.apache.lucene.search.TestTermVectors.testKnownSetOfDocuments(Test >> >> TermVectors.java:259) >> >> at >> >> org.apache.lucene.util.LuceneTestCase$SubclassSetupTeardownRule$1.eva >> >> luate(LuceneTestCase.java:705) >> >> at >> >> org.apache.lucene.util.LuceneTestCase$InternalSetupTeardownRule$1.eva >> >> luate(LuceneTestCase.java:604) >> >> at >> >> org.apache.lucene.util.LuceneTestCase$TestResultInterceptorRule$1.eva >> >> luate(LuceneTestCase.java:509) >> >> at >> >> org.apache.lucene.util.LuceneTestCase$RememberThreadRule$1.evaluate(L >> >> uceneTestCase.java:567) >> >> >> >> >> >> >> >> >> >> Build Log (for compile errors): >> >> [...truncated 13502 lines...] >> >> >> >> >> >> >> >> >> >> --------------------------------------------------------------------- >> >> To unsubscribe, e-mail: [email protected] For >> >> additional commands, e-mail: [email protected] >> > >> > >> > >> > -- >> > lucidimagination.com >> >> >> >> -- >> lucidimagination.com >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [email protected] For additional >> commands, e-mail: [email protected] > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > -- lucidimagination.com --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
