lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robert Muir <rcm...@gmail.com>
Subject Re: [JENKINS] Lucene-trunk - Build # 1835 - Failure
Date Tue, 21 Feb 2012 10:18:58 GMT
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 <uwe@thetaphi.de> 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: uwe@thetaphi.de
>
>
>> -----Original Message-----
>> From: Robert Muir [mailto:rcmuir@gmail.com]
>> Sent: Tuesday, February 21, 2012 10:58 AM
>> To: dev@lucene.apache.org
>> 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 <rcmuir@gmail.com> 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
>> > <jenkins@builds.apache.org> 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: dev-unsubscribe@lucene.apache.org For
>> >> additional commands, e-mail: dev-help@lucene.apache.org
>> >
>> >
>> >
>> > --
>> > lucidimagination.com
>>
>>
>>
>> --
>> lucidimagination.com
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org For additional
>> commands, e-mail: dev-help@lucene.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
> For additional commands, e-mail: dev-help@lucene.apache.org
>



-- 
lucidimagination.com

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


Mime
View raw message