You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by yo...@apache.org on 2015/06/03 23:47:57 UTC
svn commit: r1683433 -
/lucene/dev/trunk/solr/core/src/test/org/apache/solr/TestJoin.java
Author: yonik
Date: Wed Jun 3 21:47:57 2015
New Revision: 1683433
URL: http://svn.apache.org/r1683433
Log:
SOLR-7630: tests - fix join test when docs are reordered in index
Modified:
lucene/dev/trunk/solr/core/src/test/org/apache/solr/TestJoin.java
Modified: lucene/dev/trunk/solr/core/src/test/org/apache/solr/TestJoin.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/test/org/apache/solr/TestJoin.java?rev=1683433&r1=1683432&r2=1683433&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/test/org/apache/solr/TestJoin.java (original)
+++ lucene/dev/trunk/solr/core/src/test/org/apache/solr/TestJoin.java Wed Jun 3 21:47:57 2015
@@ -17,6 +17,7 @@
package org.apache.solr;
+import org.apache.solr.common.params.ModifiableSolrParams;
import org.noggit.JSONUtil;
import org.noggit.ObjectBuilder;
import org.apache.solr.request.SolrQueryRequest;
@@ -56,41 +57,43 @@ public class TestJoin extends SolrTestCa
assertU(commit());
+ ModifiableSolrParams p = params("sort","id asc");
+
// test debugging
- assertJQ(req("q","{!join from=dept_s to=dept_id_s}title:MTS", "fl","id", "debugQuery","true")
+ assertJQ(req(p, "q","{!join from=dept_s to=dept_id_s}title:MTS", "fl","id", "debugQuery","true")
,"/debug/join/{!join from=dept_s to=dept_id_s}title:MTS=={'_MATCH_':'fromSetSize,toSetSize', 'fromSetSize':2, 'toSetSize':3}"
);
- assertJQ(req("q","{!join from=dept_s to=dept_id_s}title:MTS", "fl","id")
+ assertJQ(req(p, "q","{!join from=dept_s to=dept_id_s}title:MTS", "fl","id")
,"/response=={'numFound':3,'start':0,'docs':[{'id':'10'},{'id':'12'},{'id':'13'}]}"
);
// empty from
- assertJQ(req("q","{!join from=noexist_s to=dept_id_s}*:*", "fl","id")
+ assertJQ(req(p, "q","{!join from=noexist_s to=dept_id_s}*:*", "fl","id")
,"/response=={'numFound':0,'start':0,'docs':[]}"
);
// empty to
- assertJQ(req("q","{!join from=dept_s to=noexist_s}*:*", "fl","id")
+ assertJQ(req(p, "q","{!join from=dept_s to=noexist_s}*:*", "fl","id")
,"/response=={'numFound':0,'start':0,'docs':[]}"
);
// self join... return everyone with she same title as Dave
- assertJQ(req("q","{!join from=title to=title}name:dave", "fl","id")
+ assertJQ(req(p, "q","{!join from=title to=title}name:dave", "fl","id")
,"/response=={'numFound':2,'start':0,'docs':[{'id':'3'},{'id':'4'}]}"
);
// find people that develop stuff
- assertJQ(req("q","{!join from=dept_id_s to=dept_s}text:develop", "fl","id")
+ assertJQ(req(p, "q","{!join from=dept_id_s to=dept_s}text:develop", "fl","id")
,"/response=={'numFound':3,'start':0,'docs':[{'id':'1'},{'id':'4'},{'id':'5'}]}"
);
// self join on multivalued text field
- assertJQ(req("q","{!join from=title to=title}name:dave", "fl","id")
+ assertJQ(req(p, "q","{!join from=title to=title}name:dave", "fl","id")
,"/response=={'numFound':2,'start':0,'docs':[{'id':'3'},{'id':'4'}]}"
);
- assertJQ(req("q","{!join from=dept_s to=dept_id_s}title:MTS", "fl","id", "debugQuery","true")
+ assertJQ(req(p, "q","{!join from=dept_s to=dept_id_s}title:MTS", "fl","id", "debugQuery","true")
,"/response=={'numFound':3,'start':0,'docs':[{'id':'10'},{'id':'12'},{'id':'13'}]}"
);
@@ -99,12 +102,12 @@ public class TestJoin extends SolrTestCa
"/response=={'numFound':2,'start':0,'docs':[{'id':'10'},{'id':'13'}]}";
// straight forward query
- assertJQ(req("q","{!join from=dept_s to=dept_id_s}name:dave",
+ assertJQ(req(p, "q","{!join from=dept_s to=dept_id_s}name:dave",
"fl","id"),
davesDepartments);
// variable deref for sub-query parsing
- assertJQ(req("q","{!join from=dept_s to=dept_id_s v=$qq}",
+ assertJQ(req(p, "q","{!join from=dept_s to=dept_id_s v=$qq}",
"qq","{!dismax}dave",
"qf","name",
"fl","id",
@@ -112,14 +115,14 @@ public class TestJoin extends SolrTestCa
davesDepartments);
// variable deref for sub-query parsing w/localparams
- assertJQ(req("q","{!join from=dept_s to=dept_id_s v=$qq}",
+ assertJQ(req(p, "q","{!join from=dept_s to=dept_id_s v=$qq}",
"qq","{!dismax qf=name}dave",
"fl","id",
"debugQuery","true"),
davesDepartments);
// defType local param to control sub-query parsing
- assertJQ(req("q","{!join from=dept_s to=dept_id_s defType=dismax}dave",
+ assertJQ(req(p, "q","{!join from=dept_s to=dept_id_s defType=dismax}dave",
"qf","name",
"fl","id",
"debugQuery","true"),
@@ -127,7 +130,7 @@ public class TestJoin extends SolrTestCa
// find people that develop stuff - but limit via filter query to a name of "john"
// this tests filters being pushed down to queries (SOLR-3062)
- assertJQ(req("q","{!join from=dept_id_s to=dept_s}text:develop", "fl","id", "fq", "name:john")
+ assertJQ(req(p, "q","{!join from=dept_id_s to=dept_s}text:develop", "fl","id", "fq", "name:john")
,"/response=={'numFound':1,'start':0,'docs':[{'id':'1'}]}"
);