MG>scroll down to org.apache.solr.BaseDistributedSearchTestCase.java MG>public static String compare(SolrDocumentList a, SolrDocumentList b, int flags, Map<String, Integer> handle)
From: david.w.smi...@gmail.com Date: Mon, 28 Mar 2016 19:22:28 +0000 Subject: Re: Test Issues To: dev@lucene.apache.org https://issues.apache.org/jira/browse/SOLR-6612 On Mon, Mar 28, 2016 at 3:19 PM Mike Drob <mad...@cloudera.com> wrote: Thanks, David. Is there a JIRA associated with this known issue? Now that I knew what I was looking for, I had to also skip timestamp and _version_, but after that everything works as expected. On Mon, Mar 28, 2016 at 12:10 PM, David Smiley <david.w.smi...@gmail.com> wrote: Most likely you need to add this to your test:handle.put("maxScore", SKIPVAL); There is a known issue in which wether maxScore is returned or not in distributed search vs non-distributed is inconsistent, in the event you didn't ask for the score explicitly (e.g. by setting 'fl=score') On Mon, Mar 28, 2016 at 3:07 PM Mike Drob <mad...@cloudera.com> wrote: I feel like I have to be missing something simple, and yet I find myself asking on the mailing list. I've narrowed down my failing test to something that I don't think it related to my code changes at all and I'm struggling to understand what I'm failing to set up correctly in this environment. This test consistently fails for me: public class MyTest extends BaseDistributedSearchTestCase { @Override protected String getSolrXml() { return "solr.xml"; } public MyTest() { fixShardCount(1); } @Test public void test() throws Exception { index(id, 1); commit(); query("q", "*:*"); } } With the following trace: junit.framework.AssertionFailedError: .response.maxScore:1.0!=null at __randomizedtesting.SeedInfo.seed([9EDA50B342BBA70E:5699086545248268]:0) at junit.framework.Assert.fail(Assert.java:50) at org.apache.solr.BaseDistributedSearchTestCase.compareSolrResponses(BaseDistributedSearchTestCase.java:924) at org.apache.solr.BaseDistributedSearchTestCase.compareResponses(BaseDistributedSearchTestCase.java:943) at org.apache.solr.BaseDistributedSearchTestCase.query(BaseDistributedSearchTestCase.java:618) at org.apache.solr.BaseDistributedSearchTestCase.query(BaseDistributedSearchTestCase.java:598) at org.apache.solr.BaseDistributedSearchTestCase.query(BaseDistributedSearchTestCase.java:577) at org.apache.solr.mytest.MyTrace.test(MyTest.java:61) at ... MG>compare method is where maxScore is tested ( or disabled with handle.put("maxScore", 4) ) public static String compare(SolrDocumentList a, SolrDocumentList b, int flags, Map<String, Integer> handle) { boolean ordered = (flags & UNORDERED) == 0; String cmp; int f = flags(handle, "maxScore"); if ((f & SKIPVAL) == 0) { cmp = compare(a.getMaxScore(), b.getMaxScore(), 0, handle); if (cmp != null) return ".maxScore" + cmp; } else { if (b.getMaxScore() != null) { //why not put if(b.getMaxScore()!=null) before if ((f & SKIPVAL) == 0) { and avoid NPE if (a.getMaxScore() == null) { return ".maxScore missing"; } } }... return null; }MG>why not put if(b.getMaxScore()!=null) before if ((f & SKIPVAL) == 0) { and avoid NPE I've tried copying from existing test cases, but haven't had any luck so far. Any pointers on this? Mike -- Lucene/Solr Search Committer, Consultant, Developer, Author, SpeakerLinkedIn: http://linkedin.com/in/davidwsmiley | Book: http://www.solrenterprisesearchserver.com -- Lucene/Solr Search Committer, Consultant, Developer, Author, SpeakerLinkedIn: http://linkedin.com/in/davidwsmiley | Book: http://www.solrenterprisesearchserver.com