You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Smiley, David W." <ds...@mitre.org> on 2014/02/17 04:56:11 UTC
Ensuring a test uses a codec supporting DocValues
I wrote a test that requires DocValues. It failed on me once because of the Codec randomization chose Lucene3x which doesn’t support DocValues. What’s the best way to adjust my test to assure this doesn’t happen?
What I ended up doing was this:
indexWriterConfig.setCodec( _TestUtil.alwaysDocValuesFormat(new Lucene45DocValuesFormat()));
But I don’t like that I hard-coded a particular format.
(FYI the source file is an abstract base test class: SpatialTestCase, method newIndexWriterConfig )
Another approach might be to call:
assumeTrue(defaultCodecSupportsDocValues())
Although sometimes the test of course won’t be run at all instead of it preferably forcing a compatible format.
Thoughts?
~ David
Re: Ensuring a test uses a codec supporting DocValues
Posted by Chris Hostetter <ho...@fucit.org>.
: >just put this annotation at the class level:
: >
: >@SuppressCodecs("Lucene3x")
Be aware of subtleties though... Just because a codec supports docvalues
doesn't mean it supports *all* of the docvalue features you need.
Example: the cursor tests failed in extremeley weird non-reproducible ways
when using some of the Lucene 4 codecs because they created DocValue
fields w/o requiring a value in every doc, and that caused
non-deterministic behavior at query time. So in that case we had to
supress more then just Lucene3x.
-Hoss
http://www.lucidworks.com/
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org
Re: Ensuring a test uses a codec supporting DocValues
Posted by "Smiley, David W." <ds...@mitre.org>.
Thanks Simon.
On 2/17/14, 4:50 AM, "Simon Willnauer" <si...@gmail.com> wrote:
>just put this annotation at the class level:
>
>@SuppressCodecs("Lucene3x")
>
>simon
>
>On Mon, Feb 17, 2014 at 4:56 AM, Smiley, David W. <ds...@mitre.org>
>wrote:
>> I wrote a test that requires DocValues. It failed on me once because of
>>the
>> Codec randomization chose Lucene3x which doesn’t support DocValues.
>>What’s
>> the best way to adjust my test to assure this doesn’t happen?
>>
>> What I ended up doing was this:
>> indexWriterConfig.setCodec( _TestUtil.alwaysDocValuesFormat(new
>> Lucene45DocValuesFormat()));
>> But I don’t like that I hard-coded a particular format.
>> (FYI the source file is an abstract base test class: SpatialTestCase,
>>method
>> newIndexWriterConfig )
>>
>> Another approach might be to call:
>> assumeTrue(defaultCodecSupportsDocValues())
>> Although sometimes the test of course won’t be run at all instead of it
>> preferably forcing a compatible format.
>>
>> Thoughts?
>>
>> ~ David
>
>---------------------------------------------------------------------
>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
Re: Ensuring a test uses a codec supporting DocValues
Posted by Simon Willnauer <si...@gmail.com>.
just put this annotation at the class level:
@SuppressCodecs("Lucene3x")
simon
On Mon, Feb 17, 2014 at 4:56 AM, Smiley, David W. <ds...@mitre.org> wrote:
> I wrote a test that requires DocValues. It failed on me once because of the
> Codec randomization chose Lucene3x which doesn’t support DocValues. What’s
> the best way to adjust my test to assure this doesn’t happen?
>
> What I ended up doing was this:
> indexWriterConfig.setCodec( _TestUtil.alwaysDocValuesFormat(new
> Lucene45DocValuesFormat()));
> But I don’t like that I hard-coded a particular format.
> (FYI the source file is an abstract base test class: SpatialTestCase, method
> newIndexWriterConfig )
>
> Another approach might be to call:
> assumeTrue(defaultCodecSupportsDocValues())
> Although sometimes the test of course won’t be run at all instead of it
> preferably forcing a compatible format.
>
> Thoughts?
>
> ~ David
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org