lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yo...@apache.org
Subject svn commit: r1337955 - in /lucene/dev/trunk/solr: core/src/java/org/apache/solr/search/JoinQParserPlugin.java solrj/src/test/org/apache/solr/client/solrj/MultiCoreExampleTestBase.java
Date Sun, 13 May 2012 18:08:28 GMT
Author: yonik
Date: Sun May 13 18:08:28 2012
New Revision: 1337955

URL: http://svn.apache.org/viewvc?rev=1337955&view=rev
Log:
SOLR-2824: don't rewrite join subquery

Modified:
    lucene/dev/trunk/solr/core/src/java/org/apache/solr/search/JoinQParserPlugin.java
    lucene/dev/trunk/solr/solrj/src/test/org/apache/solr/client/solrj/MultiCoreExampleTestBase.java

Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/search/JoinQParserPlugin.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/search/JoinQParserPlugin.java?rev=1337955&r1=1337954&r2=1337955&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/search/JoinQParserPlugin.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/search/JoinQParserPlugin.java Sun
May 13 18:08:28 2012
@@ -84,11 +84,8 @@ class JoinQuery extends Query {
 
   @Override
   public Query rewrite(IndexReader reader) throws IOException {
-    Query newQ = q.rewrite(reader);
-    if (newQ == q) return this;
-    JoinQuery nq = (JoinQuery)this.clone();
-    nq.q = newQ;
-    return nq;
+    // don't rewrite the subQuery
+    return this;
   }
 
   @Override

Modified: lucene/dev/trunk/solr/solrj/src/test/org/apache/solr/client/solrj/MultiCoreExampleTestBase.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/solrj/src/test/org/apache/solr/client/solrj/MultiCoreExampleTestBase.java?rev=1337955&r1=1337954&r2=1337955&view=diff
==============================================================================
--- lucene/dev/trunk/solr/solrj/src/test/org/apache/solr/client/solrj/MultiCoreExampleTestBase.java
(original)
+++ lucene/dev/trunk/solr/solrj/src/test/org/apache/solr/client/solrj/MultiCoreExampleTestBase.java
Sun May 13 18:08:28 2012
@@ -138,7 +138,18 @@ public abstract class MultiCoreExampleTe
     }
     catch( Exception ex ) {}
     resetExceptionIgnores();
-    
+
+    // in core0
+    doc = new SolrInputDocument();
+    doc.setField( "id", "BBB1" );
+    doc.setField( "name", "AAA1" );
+    doc.setField( "type", "BBB" );
+    doc.setField( "core0", "AAA1" );
+
+    up.clear();
+    up.add( doc );
+    up.process( getSolrCore0() );
+
     // now Make sure AAA is in 0 and BBB in 1
     SolrQuery q = new SolrQuery();
     QueryRequest r = new QueryRequest( q );
@@ -155,9 +166,15 @@ public abstract class MultiCoreExampleTe
 
     // cross-core join
     assertEquals( 0, getSolrCore0().query( new SolrQuery( "{!join from=type to=name}*:*"
) ).getResults().size() );  // normal join
-    assertEquals( 1, getSolrCore0().query( new SolrQuery( "{!join from=type to=name fromIndex=core1}id:BBB"
) ).getResults().size() );
+    assertEquals( 2, getSolrCore0().query( new SolrQuery( "{!join from=type to=name fromIndex=core1}id:BBB"
) ).getResults().size() );
     assertEquals( 1, getSolrCore1().query( new SolrQuery( "{!join from=type to=name fromIndex=core0}id:AAA"
) ).getResults().size() );
 
+    // test that no rewrite happens in core0 (if it does, it will rewrite to BBB1 and nothing
will be found in core1)
+    assertEquals( 2, getSolrCore0().query( new SolrQuery( "{!join from=type to=name fromIndex=core1}id:BB~"
) ).getResults().size() );
+
+    // test that query is parsed in the fromCore  - TODO
+    // assertEquals( 2, getSolrCore0().query( new SolrQuery( "{!join from=type to=name fromIndex=core1}core1:yup"
) ).getResults().size() );
+
 
     // Now test reloading it should have a newer open time
     String name = "core0";



Mime
View raw message