Details
-
Improvement
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
Description
Caveat SOLR-12275 bug in Solr 7.3
{!filters} as wells as filters local param in {!parent filters=...}... and {!child filters=..}... is broken in 7.3, workaround is adding cache=false as a local parameter. SOLR-12275 is fixed in Solr 7.4.
Challenge
- Since
SOLR-5743achieved block join child level facets with counts roll-up to parents, there is a demand for filter exclusions.
Context
- Then, it's worth to consider JSON Facets as an engine for this functionality rather than support a separate component.
- During a discussion in
SOLR-8998a solution for block join with child level exclusion has been found.
Proposal
It's proposed to provide a bit of syntax sugar to make it user friendly, believe it or not.
List of improvements
- introducing a local parameter filters for {!parent query parser referring to multiple filters queries via parameter name: {{
{!parent filters=$child.fq ..}
..&child.fq=color:Red&child.fq=size:XL}}
these filters are intersected with a child query supplied as a subordinate clause. - introducing {!filters param=$child.fq excludeTags=color v=$subq}&subq=text:word&child.fq= {!tag=color}color:Red&child.fq=size:XL it intersects a subordinate clause (here it's subq param, and the trick is to refer to the same query from {{
{!parent}
}}), with multiple filters supplied via parameter name param=$child.fq, it also supports excludeTags.
Notes
Regarding the latter parser, the alternative approach might be to move into {{domain:
{..}}} instruction of json facet. From the implementation perspective, it's desired to optimize with bitset processing, however I suppose it's might be deferred until some initial level of maturity.
Example
q={!parent which=type_s:book filters=$child.fq v=$childquery}&childquery=comment_t:good&child.fq={!tag=author}author_s:yonik&child.fq={!tag=stars}stars_i:(5 3)&wt=json&indent=on&json.facet={ comments_for_author:{ type:query, q:"{!filters param=$child.fq excludeTags=author v=$childquery}", "//note":"author filter is excluded", domain:{ blockChildren:"type_s:book", "//":"applying filters here might be more promising" }, facet:{ authors:{ type:terms, field:author_s, facet: { in_books: "unique(_root_)" } } } } , comments_for_stars:{ type:query, q:"{!filters param=$child.fq excludeTags=stars v=$childquery}", "//note":"stars_i filter is excluded", domain:{ blockChildren:"type_s:book" }, facet:{ stars:{ type:terms, field:stars_i, facet: { in_books: "unique(_root_)" } } } } }
Votes? Opinions?
Attachments
Attachments
Issue Links
- is broken by
-
SOLR-12275 {!filters} are cached wrong
- Closed
- is related to
-
SOLR-9683 include/exclude filters by tag
- Open
-
SOLR-9681 add filter to any facet
- Resolved
-
SOLR-9685 tag a query in JSON syntax
- Closed
- relates to
-
SOLR-5743 Faceting with BlockJoin support
- Closed
-
SOLR-8998 JSON Facet API child roll-ups
- Closed
-
SOLR-14539 Query DSL: Introducing {!bool excludeTags=foo,bar}
- Closed