From fa11c895177a89d0ecef7a8ca984b0c293b8a82c Mon Sep 17 00:00:00 2001 From: Yonik Seeley Date: Wed, 1 Feb 2012 22:02:07 +0000 Subject: [PATCH] SOLR-3062: join was ignoring acceptDocs git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1239355 13f79535-47bb-0310-9956-ffa450edef68 --- solr/CHANGES.txt | 3 +++ .../src/java/org/apache/solr/search/JoinQParserPlugin.java | 3 ++- solr/core/src/test/org/apache/solr/TestJoin.java | 6 ++++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt index 6d94d11ffa4..592c25fa03d 100644 --- a/solr/CHANGES.txt +++ b/solr/CHANGES.txt @@ -303,6 +303,9 @@ Bug Fixes * SOLR-3037: When using binary format in solrj the codec screws up parameters (Sami Siren via yonik) +* SOLR-3062: A join in the main query was not respecting any filters pushed + down to it via acceptDocs since LUCENE-1536. (Mike Hugo, yonik) + Other Changes ---------------------- diff --git a/solr/core/src/java/org/apache/solr/search/JoinQParserPlugin.java b/solr/core/src/java/org/apache/solr/search/JoinQParserPlugin.java index 5f2943f8fe9..55c6b876a8d 100644 --- a/solr/core/src/java/org/apache/solr/search/JoinQParserPlugin.java +++ b/solr/core/src/java/org/apache/solr/search/JoinQParserPlugin.java @@ -220,7 +220,8 @@ class JoinQuery extends Query { filter = resultSet.getTopFilter(); } - DocIdSet readerSet = filter.getDocIdSet(context, null); // this set only includes live docs + // Although this set only includes live docs, other filters can be pushed down to queries. + DocIdSet readerSet = filter.getDocIdSet(context, acceptDocs); if (readerSet == null) readerSet=DocIdSet.EMPTY_DOCIDSET; return new JoinScorer(this, readerSet.iterator(), getBoost()); } diff --git a/solr/core/src/test/org/apache/solr/TestJoin.java b/solr/core/src/test/org/apache/solr/TestJoin.java index 2a19a3f3654..ebb65603b7a 100644 --- a/solr/core/src/test/org/apache/solr/TestJoin.java +++ b/solr/core/src/test/org/apache/solr/TestJoin.java @@ -128,6 +128,12 @@ public class TestJoin extends SolrTestCaseJ4 { "debugQuery","true"), davesDepartments); + // 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") + ,"/response=={'numFound':1,'start':0,'docs':[{'id':'1'}]}" + ); + }