You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Rick Leir <ri...@canadiana.ca> on 2015/11/29 15:47:32 UTC

Fwd: Block Joins

Hi all,
I am new to Block Joins, and am trying to follow
https://cwiki.apache.org/confluence/display/solr/Other+Parsers#OtherParsers-BlockJoinQueryParsers

This page shows two forms of block join

syntax for this parser   q={!child of=<allParents>}<someParents>.
example query            q={!child
of="content_type:parentDocument"}title:lucene
return output is the children.

syntax for this parser   q={!parent which=<allParents>}<someChildren>
example query            q={!parent
which="content_type:parentDocument"}comments:SolrCloud
return output is their parents.


Is it possible to get a list of the matching children, along with the
parent record? I have tried


$ curl http://localhost:8983/solr/dorsetdata/query -d '
q={!parent which="content_type:parentDocument"} type_s:page AND civilian&
wt=json&indent=true&fl=score,*,[docid]'

This gives me just the parent record's fields.

$ curl http://localhost:8983/solr/dorsetdata/query -d '
q={!child of="content_type:parentDocument"}&
wt=json&indent=true&fl=score,*,[docid]'

This gives me a list of parent records.

$ curl http://localhost:8983/solr/dorsetdata/query -d '
q={!child of="content_type:parentDocument"} type_s:book AND
publication_type:journal&
wt=json&indent=true&fl=score,*,[docid]'

This gives me the child records but no info from the parent record.



Compare this with normal faceting:

$ curl http://localhost:8983/solr/dorsetdata/query -d '
q=that&fl=canonicalMaster&
json.facet={
   hits : {
      type: terms,
      field: pkey
   }
}'

This just gives me fields from the children records.

Compare this with faceting on parents:

curl http://localhost:8983/solr/dorsetdata/query -d '
q=that&
fl=*&
json.facet={ hits :
     { type: terms,
       field: pkey,
       domain:
          { blockParent : "type_s:book" } } }'

This gives me fields from the children, and a list of parents, but not
fields from the parent records.

But what I need is fields from the matching children, along with fields
from the parent record.
TIA -- Rick

Re: Block Joins

Posted by Mikhail Khludnev <mk...@griddynamics.com>.
Hello Rick,

If I got you right, it's worth to have a look at [child]
https://cwiki.apache.org/confluence/display/solr/Transforming+Result+Documents
Let me know if it works.

On Sun, Nov 29, 2015 at 5:47 PM, Rick Leir <ri...@canadiana.ca>
wrote:

> Hi all,
> I am new to Block Joins, and am trying to follow
>
> https://cwiki.apache.org/confluence/display/solr/Other+Parsers#OtherParsers-BlockJoinQueryParsers
>
> This page shows two forms of block join
>
> syntax for this parser   q={!child of=<allParents>}<someParents>.
> example query            q={!child
> of="content_type:parentDocument"}title:lucene
> return output is the children.
>
> syntax for this parser   q={!parent which=<allParents>}<someChildren>
> example query            q={!parent
> which="content_type:parentDocument"}comments:SolrCloud
> return output is their parents.
>
>
> Is it possible to get a list of the matching children, along with the
> parent record? I have tried
>
>
> $ curl http://localhost:8983/solr/dorsetdata/query -d '
> q={!parent which="content_type:parentDocument"} type_s:page AND civilian&
> wt=json&indent=true&fl=score,*,[docid]'
>
> This gives me just the parent record's fields.
>
> $ curl http://localhost:8983/solr/dorsetdata/query -d '
> q={!child of="content_type:parentDocument"}&
> wt=json&indent=true&fl=score,*,[docid]'
>
> This gives me a list of parent records.
>
> $ curl http://localhost:8983/solr/dorsetdata/query -d '
> q={!child of="content_type:parentDocument"} type_s:book AND
> publication_type:journal&
> wt=json&indent=true&fl=score,*,[docid]'
>
> This gives me the child records but no info from the parent record.
>
>
>
> Compare this with normal faceting:
>
> $ curl http://localhost:8983/solr/dorsetdata/query -d '
> q=that&fl=canonicalMaster&
> json.facet={
>    hits : {
>       type: terms,
>       field: pkey
>    }
> }'
>
> This just gives me fields from the children records.
>
> Compare this with faceting on parents:
>
> curl http://localhost:8983/solr/dorsetdata/query -d '
> q=that&
> fl=*&
> json.facet={ hits :
>      { type: terms,
>        field: pkey,
>        domain:
>           { blockParent : "type_s:book" } } }'
>
> This gives me fields from the children, and a list of parents, but not
> fields from the parent records.
>
> But what I need is fields from the matching children, along with fields
> from the parent record.
> TIA -- Rick
>



-- 
Sincerely yours
Mikhail Khludnev
Principal Engineer,
Grid Dynamics

<http://www.griddynamics.com>
<mk...@griddynamics.com>