mirror of https://github.com/apache/lucene.git
SOLR-2325: allow tagging and exclusion of many query for faceting
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1061424 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
00a3df84d4
commit
f320ade2b7
|
@ -106,6 +106,8 @@ New Features
|
|||
Adding a parameter NOW=<time_in_ms> to the request will override the
|
||||
current time. (Peter Sturge, yonik)
|
||||
|
||||
* SOLR-2325: Allow tagging and exlcusion of main query for faceting. (yonik)
|
||||
|
||||
Optimizations
|
||||
----------------------
|
||||
|
||||
|
|
|
@ -147,14 +147,17 @@ public class SimpleFacets {
|
|||
List<Query> qlist = new ArrayList<Query>();
|
||||
|
||||
// add the base query
|
||||
qlist.add(rb.getQuery());
|
||||
if (!excludeSet.containsKey(rb.getQuery())) {
|
||||
qlist.add(rb.getQuery());
|
||||
}
|
||||
|
||||
// add the filters
|
||||
for (Query q : rb.getFilters()) {
|
||||
if (!excludeSet.containsKey(q)) {
|
||||
qlist.add(q);
|
||||
if (rb.getFilters() != null) {
|
||||
for (Query q : rb.getFilters()) {
|
||||
if (!excludeSet.containsKey(q)) {
|
||||
qlist.add(q);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// get the new base docset for this facet
|
||||
|
|
|
@ -169,6 +169,16 @@ public class SimpleFacetsTest extends SolrTestCaseJ4 {
|
|||
,"//lst[@name='trait_s']/int[@name='Pig'][.='1']"
|
||||
);
|
||||
|
||||
// test excluding main query
|
||||
assertQ(req("q", "{!tag=main}id:43"
|
||||
,"facet", "true"
|
||||
,"facet.query", "{!key=foo}id:42"
|
||||
,"facet.query", "{!ex=main key=bar}id:42" // only matches when we exclude main query
|
||||
)
|
||||
,"//lst[@name='facet_queries']/int[@name='foo'][.='0']"
|
||||
,"//lst[@name='facet_queries']/int[@name='bar'][.='1']"
|
||||
);
|
||||
|
||||
assertQ("check counts for applied facet queries using filtering (fq)",
|
||||
req("q", "id:[42 TO 47]"
|
||||
,"facet", "true"
|
||||
|
|
Loading…
Reference in New Issue