You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Roman Chyla <ro...@gmail.com> on 2013/01/09 00:15:17 UTC
unittest fail (sometimes) for float field search
Hi,
I have a float field 'read_count' - and unittest like:
assertQ(req("q", "read_count:1.0"),
"//doc/int[@name='recid'][.='9218920']",
"//*[@numFound='1']");
sometimes, the unittest will fail, sometimes it succeeds.
@SuppressCodecs("Lucene3x")
Seems to solve the issue, however I don't understand what's wrong. Is this
behaviour expected?
thanks,
roman
INFO: Opening Searcher@752a2259 main
9.1.2013 06:51:32 org.apache.solr.search.SolrIndexSearcher getIndexDir
WARNING: WARNING: Directory impl does not support setting indexDir:
org.apache.lucene.store.MockDirectoryWrapper
9.1.2013 06:51:32 org.apache.solr.update.DirectUpdateHandler2 commit
INFO: end_commit_flush
9.1.2013 06:51:32 org.apache.solr.core.QuerySenderListener newSearcher
INFO: QuerySenderListener sending requests to
Searcher@752a2259main{StandardDirectoryReader(segments_2:3
_0(4.0.0.2):C30)}
9.1.2013 06:51:32 org.apache.solr.core.QuerySenderListener newSearcher
INFO: QuerySenderListener done.
9.1.2013 06:51:32 org.apache.solr.core.SolrCore registerSearcher
INFO: [collection1] Registered new searcher
Searcher@752a2259main{StandardDirectoryReader(segments_2:3
_0(4.0.0.2):C30)}
Re: unittest fail (sometimes) for float field search
Posted by Roman Chyla <ro...@gmail.com>.
Hi,
It is not Eclipse related, neither codec related. There were two issues
I had a wrong configuration of NumericConfig:
new NumericConfig(4, NumberFormat.getNumberInstance(), NumericType.FLOAT))
I changed that to:
new NumericConfig(4, NumberFormat.getNumberInstance(Locale.US),
NumericType.FLOAT))
And the second problem was that I used the default "float" with
precisionStep=0, however NumericRangeQuery requires precision step >=1
I tried all steps 1-8, and it worked only if the precison step of the field
and of the NumericConfig are the same (for range queries)
roman
On Tue, Jan 8, 2013 at 7:34 PM, Roman Chyla <ro...@gmail.com> wrote:
> The test checks we are properly getting/indexing data - we index database
> and fetch parts of the documents separately from mongodb. You can look at
> the file here:
> https://github.com/romanchyla/montysolr/blob/3c18312b325874bdecefceb9df63096b2cf20ca2/contrib/adsabs/src/test/org/apache/solr/update/TestAdsDataImport.java
>
> But your comment made me to run the tests on command line and I am seeing
> I can't make it fail (it fails only inside Eclipse). Sorry, I should have
> tried that myself, but I am so used to running unittests inside Eclipse it
> didn't occur to me...i'll try to find out what is going on...
>
> thanks,
>
> roman
>
>
>
>
> On Tue, Jan 8, 2013 at 6:53 PM, Chris Hostetter <ho...@fucit.org>wrote:
>
>>
>> : apparently, it fails also with @SuppressCodecs("Lucene3x")
>>
>> what exactly is the test failure message?
>>
>> When you run tests that use the lucene test framework, any failure should
>> include information about the random seed used to run the test -- that
>> random seed affects things like the codec used, the directoryfactory used,
>> etc...
>>
>> Can you confirm wether the test reliably passes/fails consistently when
>> you reuse the same seed?
>>
>> Can you elaborate more on what exactly your test does? ... we probably
>> need to see the entire test to make sense of why you might get
>> inconsistent failures.
>>
>>
>>
>> -Hoss
>>
>
>
Re: unittest fail (sometimes) for float field search
Posted by Roman Chyla <ro...@gmail.com>.
The test checks we are properly getting/indexing data - we index database
and fetch parts of the documents separately from mongodb. You can look at
the file here:
https://github.com/romanchyla/montysolr/blob/3c18312b325874bdecefceb9df63096b2cf20ca2/contrib/adsabs/src/test/org/apache/solr/update/TestAdsDataImport.java
But your comment made me to run the tests on command line and I am seeing I
can't make it fail (it fails only inside Eclipse). Sorry, I should have
tried that myself, but I am so used to running unittests inside Eclipse it
didn't occur to me...i'll try to find out what is going on...
thanks,
roman
On Tue, Jan 8, 2013 at 6:53 PM, Chris Hostetter <ho...@fucit.org>wrote:
>
> : apparently, it fails also with @SuppressCodecs("Lucene3x")
>
> what exactly is the test failure message?
>
> When you run tests that use the lucene test framework, any failure should
> include information about the random seed used to run the test -- that
> random seed affects things like the codec used, the directoryfactory used,
> etc...
>
> Can you confirm wether the test reliably passes/fails consistently when
> you reuse the same seed?
>
> Can you elaborate more on what exactly your test does? ... we probably
> need to see the entire test to make sense of why you might get
> inconsistent failures.
>
>
>
> -Hoss
>
Re: unittest fail (sometimes) for float field search
Posted by Chris Hostetter <ho...@fucit.org>.
: apparently, it fails also with @SuppressCodecs("Lucene3x")
what exactly is the test failure message?
When you run tests that use the lucene test framework, any failure should
include information about the random seed used to run the test -- that
random seed affects things like the codec used, the directoryfactory used,
etc...
Can you confirm wether the test reliably passes/fails consistently when
you reuse the same seed?
Can you elaborate more on what exactly your test does? ... we probably
need to see the entire test to make sense of why you might get
inconsistent failures.
-Hoss
Re: unittest fail (sometimes) for float field search
Posted by Roman Chyla <ro...@gmail.com>.
apparently, it fails also with @SuppressCodecs("Lucene3x")
roman
On Tue, Jan 8, 2013 at 6:15 PM, Roman Chyla <ro...@gmail.com> wrote:
> Hi,
>
> I have a float field 'read_count' - and unittest like:
>
> assertQ(req("q", "read_count:1.0"),
> "//doc/int[@name='recid'][.='9218920']",
> "//*[@numFound='1']");
>
> sometimes, the unittest will fail, sometimes it succeeds.
>
> @SuppressCodecs("Lucene3x")
>
> Seems to solve the issue, however I don't understand what's wrong. Is this
> behaviour expected?
>
> thanks,
>
> roman
>
>
> INFO: Opening Searcher@752a2259 main
> 9.1.2013 06:51:32 org.apache.solr.search.SolrIndexSearcher getIndexDir
> WARNING: WARNING: Directory impl does not support setting indexDir:
> org.apache.lucene.store.MockDirectoryWrapper
> 9.1.2013 06:51:32 org.apache.solr.update.DirectUpdateHandler2 commit
> INFO: end_commit_flush
> 9.1.2013 06:51:32 org.apache.solr.core.QuerySenderListener newSearcher
> INFO: QuerySenderListener sending requests to Searcher@752a2259main{StandardDirectoryReader(segments_2:3 _0(4.0.0.2):C30)}
> 9.1.2013 06:51:32 org.apache.solr.core.QuerySenderListener newSearcher
> INFO: QuerySenderListener done.
> 9.1.2013 06:51:32 org.apache.solr.core.SolrCore registerSearcher
> INFO: [collection1] Registered new searcher Searcher@752a2259main{StandardDirectoryReader(segments_2:3 _0(4.0.0.2):C30)}
>