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 Henning Ivan Solberg <hs...@lovdata.no> on 2014/02/11 09:21:33 UTC

Facets for fields in subdocuments with block join, is it possible?

Hello,

I'm testing block join in solr 4.6.1 and wondering, is it possible to 
get facets for fields in subdocuments with number of hits based on ROOT 
documents?

See example below:

<doc>
     <documentPart>ROOT</documentPart>
     <text>testing 123</text>
     <title>title</test>
     <group>GRP</group>
     <subdocument>
         <field3>khat</field3>
         <field4>7000</field4>
         <field5>purchase</field5>
     </subdocoment>
     <subdocument>
         <field3>cannabis</field3>
         <field4>500</field4>
         <field5>sale</field5>
     </subdocoment>
</doc>

My query looks like this:

         solrQuery.setQuery("text:testing");
         solrQuery.setFilterQueries("{!parent 
which=\"dokumentPart:ROOT\"}field3:khat");
         solrQuery.setFacet(true);
         solrQuery.addFacetField("group","field5");

This does not give me any facets for the subdocument fields, so i'm 
thinking, could a solution be to execute a second query to get the 
facets for the subdocument by join from parent to child whith a {!child 
of=} query like this:

     solrQuery.setQuery("{!child of=\"dokumentPart:ROOT\"}text:testing");
     solrQuery.setFilterQueries("field3:khat");
     solrQuery.setFacet(true);
     solrQuery.addFacetField("field5","field4", "field3");

The problem with this method is that the facet count will be based on 
sub documents and not ROOT/parent documents...

Is there a silver bullet for this kind of requirement?

Yours faithfully

Henning Solberg


Re: Facets for fields in subdocuments with block join, is it possible?

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

There is no open source facet component for child level of block-join.
There is no even open jira for this.

Don.t think it helps.
11.02.2014 12:22 пользователь "Henning Ivan Solberg" <hs...@lovdata.no>
написал:

> Hello,
>
> I'm testing block join in solr 4.6.1 and wondering, is it possible to get
> facets for fields in subdocuments with number of hits based on ROOT
> documents?
>
> See example below:
>
> <doc>
>     <documentPart>ROOT</documentPart>
>     <text>testing 123</text>
>     <title>title</test>
>     <group>GRP</group>
>     <subdocument>
>         <field3>khat</field3>
>         <field4>7000</field4>
>         <field5>purchase</field5>
>     </subdocoment>
>     <subdocument>
>         <field3>cannabis</field3>
>         <field4>500</field4>
>         <field5>sale</field5>
>     </subdocoment>
> </doc>
>
> My query looks like this:
>
>         solrQuery.setQuery("text:testing");
>         solrQuery.setFilterQueries("{!parent which=\"dokumentPart:ROOT\"}
> field3:khat");
>         solrQuery.setFacet(true);
>         solrQuery.addFacetField("group","field5");
>
> This does not give me any facets for the subdocument fields, so i'm
> thinking, could a solution be to execute a second query to get the facets
> for the subdocument by join from parent to child whith a {!child of=} query
> like this:
>
>     solrQuery.setQuery("{!child of=\"dokumentPart:ROOT\"}text:testing");
>     solrQuery.setFilterQueries("field3:khat");
>     solrQuery.setFacet(true);
>     solrQuery.addFacetField("field5","field4", "field3");
>
> The problem with this method is that the facet count will be based on sub
> documents and not ROOT/parent documents...
>
> Is there a silver bullet for this kind of requirement?
>
> Yours faithfully
>
> Henning Solberg
>
>