mirror of https://github.com/apache/lucene.git
SOLR-2824: don't rewrite join subquery
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1337955 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
7e511f80d1
commit
015d8601c8
|
@ -84,11 +84,8 @@ class JoinQuery extends Query {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Query rewrite(IndexReader reader) throws IOException {
|
public Query rewrite(IndexReader reader) throws IOException {
|
||||||
Query newQ = q.rewrite(reader);
|
// don't rewrite the subQuery
|
||||||
if (newQ == q) return this;
|
return this;
|
||||||
JoinQuery nq = (JoinQuery)this.clone();
|
|
||||||
nq.q = newQ;
|
|
||||||
return nq;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -138,7 +138,18 @@ public abstract class MultiCoreExampleTestBase extends SolrExampleTestBase
|
||||||
}
|
}
|
||||||
catch( Exception ex ) {}
|
catch( Exception ex ) {}
|
||||||
resetExceptionIgnores();
|
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
|
// now Make sure AAA is in 0 and BBB in 1
|
||||||
SolrQuery q = new SolrQuery();
|
SolrQuery q = new SolrQuery();
|
||||||
QueryRequest r = new QueryRequest( q );
|
QueryRequest r = new QueryRequest( q );
|
||||||
|
@ -155,9 +166,15 @@ public abstract class MultiCoreExampleTestBase extends SolrExampleTestBase
|
||||||
|
|
||||||
// cross-core join
|
// cross-core join
|
||||||
assertEquals( 0, getSolrCore0().query( new SolrQuery( "{!join from=type to=name}*:*" ) ).getResults().size() ); // normal 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() );
|
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
|
// Now test reloading it should have a newer open time
|
||||||
String name = "core0";
|
String name = "core0";
|
||||||
|
|
Loading…
Reference in New Issue