Uploaded image for project: 'Solr'
  1. Solr
  2. SOLR-9510

child level facet exclusions

    XMLWordPrintableJSON

Details

    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-5743 achieved 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-8998 a 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

        1. SOLR_9510.patch
          41 kB
          Mikhail Khludnev
        2. SOLR_9510.patch
          40 kB
          Mikhail Khludnev
        3. SOLR_9510.patch
          33 kB
          Mikhail Khludnev
        4. SOLR_9510.patch
          33 kB
          Mikhail Khludnev
        5. SOLR_9510.patch
          32 kB
          Mikhail Khludnev
        6. SOLR_9510.patch
          31 kB
          Mikhail Khludnev
        7. SOLR_9510.patch
          29 kB
          Dr Oleg Savrasov
        8. SOLR_9510.patch
          29 kB
          Dr Oleg Savrasov
        9. SOLR_9510.patch
          31 kB
          Mikhail Khludnev
        10. SOLR_9510.patch
          31 kB
          Mikhail Khludnev
        11. SOLR_9510.patch
          36 kB
          Mikhail Khludnev
        12. SOLR_9510.patch
          34 kB
          Ishan Chattopadhyaya
        13. SOLR_9510.patch
          35 kB
          Dr Oleg Savrasov
        14. SOLR_9510.patch
          30 kB
          Dr Oleg Savrasov
        15. SOLR_9510.patch
          31 kB
          Dr Oleg Savrasov
        16. SOLR-9510.patch
          32 kB
          Mikhail Khludnev
        17. SOLR-9510-doc.patch
          6 kB
          Mikhail Khludnev
        18. SOLR-9510-doc.patch
          6 kB
          Cassandra Targett
        19. SOLR-9510-doc.patch
          6 kB
          Mikhail Khludnev

        Issue Links

          Activity

            People

              mkhl Mikhail Khludnev
              mkhl Mikhail Khludnev
              Votes:
              7 Vote for this issue
              Watchers:
              15 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: