lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yonik Seeley <ysee...@gmail.com>
Subject Parent/Child (Nested Document) Faceting
Date Sun, 14 Jun 2015 01:02:33 GMT
Hey Folks, I'd love some feedback on the interface for nested document
faceting (or rather switching facet domains to/from parent/child).

See the bottom of this blog:
http://yonik.com/solr-nested-objects/

Issue #1: How to specify that one should change domains before faceting?

I originally started out with a new facet type (like query facet, but
switches domains).
So if you started out querying a child of type book, you would first
do a "blockParent" facet to map the domain to parents, and then put
the actual facet you wanted as a sub-facet.

q=book_review:xxxxxx  /* query some child-doc of book */
json.facet=
  {  // NOTE: this was my first pass... not the current interface
    books : {
      type: blockParent,
      parentFilter : "type:book"
      facet : {
        authors : {
          type : terms,
          field : author
        }
     }
  }

Although having a separate facet type to map domains is logically very
clean, it does introduce an additional level of indentation which may
not be desired.

So then I thought about including domain switching operations under a
"domain" directive in the facet itself:

json.facet=
{  // current form a domain switching facet
  authors : {
    type: terms,
    field: author,
    domain : {blockParent:"type:book"}
  }
}

I envision some future other options for "domain" including the
ability to reset the domain with another query (ignoring your parent
domain), or adding additional filters to the domain before faceting,
or normal (non-block) joins.

Issue #2: Naming

I avoided toParent and toChild because people cloud be confused that
it would work on any sort of parent/child relationship (i.e. other
than nested documents).

I used "blockParent" and "blockChildren" because I was thinking about
block join.
One alternative that might be better could be "nested" (i.e. nestedParent).

Pluralization:
I picked the singular for blockParent and plural for blockChildren
since a single block as one parent and multiple children.  But you
could think about it in other ways since we're mapping a set of
documents at a time (i.e. both could be pluralized).

Options:
nestedParent, nestedChildren   // current option
nestedParents, nestedChildren // both plural
nestedChild, nestedParent        // both singular

Feedback appreciated!

-Yonik

Mime
View raw message