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 Peter Sturge <pe...@gmail.com> on 2015/10/11 16:51:13 UTC

Grouping facets: Possible to get facet results for each Group?

Hello Solr Forum,

Been trying to coerce Group faceting to give some faceting back for each
group, but maybe this use case isn't catered for in Grouping? :

So the Use Case is this:
Let's say I do a grouped search that returns say, 9 distinct groups, and in
these groups are various numbers of unique field values that need faceting
- but the faceting needs to be within each group:


user:*&facet=true&facet.field=user&group=true&group.field=host&group.facet=true

This query gives back grouped facets for each 'host' value (i.e. the facet
counts are 'collapsed') - but the facet counts (unique values of 'user'
field) are aggregated for all the groups, not on a 'per-group' basis (i.e.
returned as 'global facets' - outside of the grouped results).
The results from the query above doesn't say which unique values for
'users' are in which group. If the number of doc hits is very large (can
easily be in the 100's of thousands) it's not practical to iterate through
the docs looking for unique values.
This Use Case necessitates the unique values within each group, rather than
the total doc hits.

Is this possible with grouping, or inconjunction with another module?

Many thanks,
+Peter

Re: Grouping facets: Possible to get facet results for each Group?

Posted by Peter Sturge <pe...@gmail.com>.
Great - can't wait to try this out! Many thanks for your help on pointing
me towards this new faceting feature.
Thanks,
Peter


On Thu, Oct 15, 2015 at 10:04 AM, Alessandro Benedetti <
benedetti.alex85@gmail.com> wrote:

> It will not be an impediment, if you have a flat document with single
> valued field interested, you can use Pivot Facets and apply stats over the
> facets as well.
> Take a look to the modern Json faceting approach Yonik introduced.
> Since I start using it I strongly recommend it, it's amazingly clear to
> define your faceting structure, store it in a file in Json and use it at
> query time !
>
> I am a strong supporter of this approach, it is young but already powerful.
> Pretty sure it will help you.
>
> Cheers
>
> [1] http://yonik.com/json-facet-api/
> [2] http://yonik.com/solr-facet-functions/
> [3] http://yonik.com/solr-subfacets/
>
> On 14 October 2015 at 22:12, Peter Sturge <pe...@gmail.com> wrote:
>
> > Yes, you are right about that - I've used pivots before and they do need
> to
> > be used judiciously.
> > Fortunately, we only ever use single-value fields, as it gives some good
> > advantages in a heavily sharded environment.
> > Our document structure is, by it's very nature always flat, so it could
> be
> > an impediment to nested facets, but I don't know enough about them to
> know
> > for sure.
> > Thanks,
> > Peter
> >
> >
> > On Wed, Oct 14, 2015 at 9:44 AM, Alessandro Benedetti <
> > benedetti.alex85@gmail.com> wrote:
> >
> > > mmm let's say that nested facets are a subset of Pivot Facets.
> > > if pivot faceting works with the classic flat document structure, the
> sub
> > > facet are working with any nested structure.
> > > So be careful about pivot faceting in a flat document with multi valued
> > > fields, because you lose the relation across the different fields
> value.
> > >
> > > Cheers
> > >
> > > On 13 October 2015 at 18:06, Peter Sturge <pe...@gmail.com>
> > wrote:
> > >
> > > > Hi,
> > > > Thanks for your response.
> > > > I did have a look at pivots, and they could work in a way. We're
> still
> > on
> > > > Solr 4.3, so I'll have to wait for sub-facets - but they sure look
> > pretty
> > > > cool!
> > > > Peter
> > > >
> > > >
> > > > On Tue, Oct 13, 2015 at 12:30 PM, Alessandro Benedetti <
> > > > benedetti.alex85@gmail.com> wrote:
> > > >
> > > > > Can you model your business domain with Solr nested Docs ? In the
> > case
> > > > you
> > > > > can use Yonik article about nested facets.
> > > > >
> > > > > Cheers
> > > > >
> > > > > On 13 October 2015 at 05:05, Alexandre Rafalovitch <
> > arafalov@gmail.com
> > > >
> > > > > wrote:
> > > > >
> > > > > > Could you use the new nested facets syntax?
> > > > > > http://yonik.com/solr-subfacets/
> > > > > >
> > > > > > Regards,
> > > > > >    Alex.
> > > > > > ----
> > > > > > Solr Analyzers, Tokenizers, Filters, URPs and even a newsletter:
> > > > > > http://www.solr-start.com/
> > > > > >
> > > > > > On 11 October 2015 at 09:51, Peter Sturge <
> peter.sturge@gmail.com>
> > > > > wrote:
> > > > > > > Been trying to coerce Group faceting to give some faceting back
> > for
> > > > > each
> > > > > > > group, but maybe this use case isn't catered for in Grouping? :
> > > > > > >
> > > > > > > So the Use Case is this:
> > > > > > > Let's say I do a grouped search that returns say, 9 distinct
> > > groups,
> > > > > and
> > > > > > in
> > > > > > > these groups are various numbers of unique field values that
> need
> > > > > > faceting
> > > > > > > - but the faceting needs to be within each group:
> > > > > >
> > > > >
> > > > >
> > > > >
> > > > > --
> > > > > --------------------------
> > > > >
> > > > > Benedetti Alessandro
> > > > > Visiting card - http://about.me/alessandro_benedetti
> > > > > Blog - http://alexbenedetti.blogspot.co.uk
> > > > >
> > > > > "Tyger, tyger burning bright
> > > > > In the forests of the night,
> > > > > What immortal hand or eye
> > > > > Could frame thy fearful symmetry?"
> > > > >
> > > > > William Blake - Songs of Experience -1794 England
> > > > >
> > > >
> > >
> > >
> > >
> > > --
> > > --------------------------
> > >
> > > Benedetti Alessandro
> > > Visiting card - http://about.me/alessandro_benedetti
> > > Blog - http://alexbenedetti.blogspot.co.uk
> > >
> > > "Tyger, tyger burning bright
> > > In the forests of the night,
> > > What immortal hand or eye
> > > Could frame thy fearful symmetry?"
> > >
> > > William Blake - Songs of Experience -1794 England
> > >
> >
>
>
>
> --
> --------------------------
>
> Benedetti Alessandro
> Visiting card - http://about.me/alessandro_benedetti
> Blog - http://alexbenedetti.blogspot.co.uk
>
> "Tyger, tyger burning bright
> In the forests of the night,
> What immortal hand or eye
> Could frame thy fearful symmetry?"
>
> William Blake - Songs of Experience -1794 England
>

Re: Grouping facets: Possible to get facet results for each Group?

Posted by Alessandro Benedetti <be...@gmail.com>.
It will not be an impediment, if you have a flat document with single
valued field interested, you can use Pivot Facets and apply stats over the
facets as well.
Take a look to the modern Json faceting approach Yonik introduced.
Since I start using it I strongly recommend it, it's amazingly clear to
define your faceting structure, store it in a file in Json and use it at
query time !

I am a strong supporter of this approach, it is young but already powerful.
Pretty sure it will help you.

Cheers

[1] http://yonik.com/json-facet-api/
[2] http://yonik.com/solr-facet-functions/
[3] http://yonik.com/solr-subfacets/

On 14 October 2015 at 22:12, Peter Sturge <pe...@gmail.com> wrote:

> Yes, you are right about that - I've used pivots before and they do need to
> be used judiciously.
> Fortunately, we only ever use single-value fields, as it gives some good
> advantages in a heavily sharded environment.
> Our document structure is, by it's very nature always flat, so it could be
> an impediment to nested facets, but I don't know enough about them to know
> for sure.
> Thanks,
> Peter
>
>
> On Wed, Oct 14, 2015 at 9:44 AM, Alessandro Benedetti <
> benedetti.alex85@gmail.com> wrote:
>
> > mmm let's say that nested facets are a subset of Pivot Facets.
> > if pivot faceting works with the classic flat document structure, the sub
> > facet are working with any nested structure.
> > So be careful about pivot faceting in a flat document with multi valued
> > fields, because you lose the relation across the different fields value.
> >
> > Cheers
> >
> > On 13 October 2015 at 18:06, Peter Sturge <pe...@gmail.com>
> wrote:
> >
> > > Hi,
> > > Thanks for your response.
> > > I did have a look at pivots, and they could work in a way. We're still
> on
> > > Solr 4.3, so I'll have to wait for sub-facets - but they sure look
> pretty
> > > cool!
> > > Peter
> > >
> > >
> > > On Tue, Oct 13, 2015 at 12:30 PM, Alessandro Benedetti <
> > > benedetti.alex85@gmail.com> wrote:
> > >
> > > > Can you model your business domain with Solr nested Docs ? In the
> case
> > > you
> > > > can use Yonik article about nested facets.
> > > >
> > > > Cheers
> > > >
> > > > On 13 October 2015 at 05:05, Alexandre Rafalovitch <
> arafalov@gmail.com
> > >
> > > > wrote:
> > > >
> > > > > Could you use the new nested facets syntax?
> > > > > http://yonik.com/solr-subfacets/
> > > > >
> > > > > Regards,
> > > > >    Alex.
> > > > > ----
> > > > > Solr Analyzers, Tokenizers, Filters, URPs and even a newsletter:
> > > > > http://www.solr-start.com/
> > > > >
> > > > > On 11 October 2015 at 09:51, Peter Sturge <pe...@gmail.com>
> > > > wrote:
> > > > > > Been trying to coerce Group faceting to give some faceting back
> for
> > > > each
> > > > > > group, but maybe this use case isn't catered for in Grouping? :
> > > > > >
> > > > > > So the Use Case is this:
> > > > > > Let's say I do a grouped search that returns say, 9 distinct
> > groups,
> > > > and
> > > > > in
> > > > > > these groups are various numbers of unique field values that need
> > > > > faceting
> > > > > > - but the faceting needs to be within each group:
> > > > >
> > > >
> > > >
> > > >
> > > > --
> > > > --------------------------
> > > >
> > > > Benedetti Alessandro
> > > > Visiting card - http://about.me/alessandro_benedetti
> > > > Blog - http://alexbenedetti.blogspot.co.uk
> > > >
> > > > "Tyger, tyger burning bright
> > > > In the forests of the night,
> > > > What immortal hand or eye
> > > > Could frame thy fearful symmetry?"
> > > >
> > > > William Blake - Songs of Experience -1794 England
> > > >
> > >
> >
> >
> >
> > --
> > --------------------------
> >
> > Benedetti Alessandro
> > Visiting card - http://about.me/alessandro_benedetti
> > Blog - http://alexbenedetti.blogspot.co.uk
> >
> > "Tyger, tyger burning bright
> > In the forests of the night,
> > What immortal hand or eye
> > Could frame thy fearful symmetry?"
> >
> > William Blake - Songs of Experience -1794 England
> >
>



-- 
--------------------------

Benedetti Alessandro
Visiting card - http://about.me/alessandro_benedetti
Blog - http://alexbenedetti.blogspot.co.uk

"Tyger, tyger burning bright
In the forests of the night,
What immortal hand or eye
Could frame thy fearful symmetry?"

William Blake - Songs of Experience -1794 England

Re: Grouping facets: Possible to get facet results for each Group?

Posted by Peter Sturge <pe...@gmail.com>.
Yes, you are right about that - I've used pivots before and they do need to
be used judiciously.
Fortunately, we only ever use single-value fields, as it gives some good
advantages in a heavily sharded environment.
Our document structure is, by it's very nature always flat, so it could be
an impediment to nested facets, but I don't know enough about them to know
for sure.
Thanks,
Peter


On Wed, Oct 14, 2015 at 9:44 AM, Alessandro Benedetti <
benedetti.alex85@gmail.com> wrote:

> mmm let's say that nested facets are a subset of Pivot Facets.
> if pivot faceting works with the classic flat document structure, the sub
> facet are working with any nested structure.
> So be careful about pivot faceting in a flat document with multi valued
> fields, because you lose the relation across the different fields value.
>
> Cheers
>
> On 13 October 2015 at 18:06, Peter Sturge <pe...@gmail.com> wrote:
>
> > Hi,
> > Thanks for your response.
> > I did have a look at pivots, and they could work in a way. We're still on
> > Solr 4.3, so I'll have to wait for sub-facets - but they sure look pretty
> > cool!
> > Peter
> >
> >
> > On Tue, Oct 13, 2015 at 12:30 PM, Alessandro Benedetti <
> > benedetti.alex85@gmail.com> wrote:
> >
> > > Can you model your business domain with Solr nested Docs ? In the case
> > you
> > > can use Yonik article about nested facets.
> > >
> > > Cheers
> > >
> > > On 13 October 2015 at 05:05, Alexandre Rafalovitch <arafalov@gmail.com
> >
> > > wrote:
> > >
> > > > Could you use the new nested facets syntax?
> > > > http://yonik.com/solr-subfacets/
> > > >
> > > > Regards,
> > > >    Alex.
> > > > ----
> > > > Solr Analyzers, Tokenizers, Filters, URPs and even a newsletter:
> > > > http://www.solr-start.com/
> > > >
> > > > On 11 October 2015 at 09:51, Peter Sturge <pe...@gmail.com>
> > > wrote:
> > > > > Been trying to coerce Group faceting to give some faceting back for
> > > each
> > > > > group, but maybe this use case isn't catered for in Grouping? :
> > > > >
> > > > > So the Use Case is this:
> > > > > Let's say I do a grouped search that returns say, 9 distinct
> groups,
> > > and
> > > > in
> > > > > these groups are various numbers of unique field values that need
> > > > faceting
> > > > > - but the faceting needs to be within each group:
> > > >
> > >
> > >
> > >
> > > --
> > > --------------------------
> > >
> > > Benedetti Alessandro
> > > Visiting card - http://about.me/alessandro_benedetti
> > > Blog - http://alexbenedetti.blogspot.co.uk
> > >
> > > "Tyger, tyger burning bright
> > > In the forests of the night,
> > > What immortal hand or eye
> > > Could frame thy fearful symmetry?"
> > >
> > > William Blake - Songs of Experience -1794 England
> > >
> >
>
>
>
> --
> --------------------------
>
> Benedetti Alessandro
> Visiting card - http://about.me/alessandro_benedetti
> Blog - http://alexbenedetti.blogspot.co.uk
>
> "Tyger, tyger burning bright
> In the forests of the night,
> What immortal hand or eye
> Could frame thy fearful symmetry?"
>
> William Blake - Songs of Experience -1794 England
>

Re: Grouping facets: Possible to get facet results for each Group?

Posted by Alessandro Benedetti <be...@gmail.com>.
mmm let's say that nested facets are a subset of Pivot Facets.
if pivot faceting works with the classic flat document structure, the sub
facet are working with any nested structure.
So be careful about pivot faceting in a flat document with multi valued
fields, because you lose the relation across the different fields value.

Cheers

On 13 October 2015 at 18:06, Peter Sturge <pe...@gmail.com> wrote:

> Hi,
> Thanks for your response.
> I did have a look at pivots, and they could work in a way. We're still on
> Solr 4.3, so I'll have to wait for sub-facets - but they sure look pretty
> cool!
> Peter
>
>
> On Tue, Oct 13, 2015 at 12:30 PM, Alessandro Benedetti <
> benedetti.alex85@gmail.com> wrote:
>
> > Can you model your business domain with Solr nested Docs ? In the case
> you
> > can use Yonik article about nested facets.
> >
> > Cheers
> >
> > On 13 October 2015 at 05:05, Alexandre Rafalovitch <ar...@gmail.com>
> > wrote:
> >
> > > Could you use the new nested facets syntax?
> > > http://yonik.com/solr-subfacets/
> > >
> > > Regards,
> > >    Alex.
> > > ----
> > > Solr Analyzers, Tokenizers, Filters, URPs and even a newsletter:
> > > http://www.solr-start.com/
> > >
> > > On 11 October 2015 at 09:51, Peter Sturge <pe...@gmail.com>
> > wrote:
> > > > Been trying to coerce Group faceting to give some faceting back for
> > each
> > > > group, but maybe this use case isn't catered for in Grouping? :
> > > >
> > > > So the Use Case is this:
> > > > Let's say I do a grouped search that returns say, 9 distinct groups,
> > and
> > > in
> > > > these groups are various numbers of unique field values that need
> > > faceting
> > > > - but the faceting needs to be within each group:
> > >
> >
> >
> >
> > --
> > --------------------------
> >
> > Benedetti Alessandro
> > Visiting card - http://about.me/alessandro_benedetti
> > Blog - http://alexbenedetti.blogspot.co.uk
> >
> > "Tyger, tyger burning bright
> > In the forests of the night,
> > What immortal hand or eye
> > Could frame thy fearful symmetry?"
> >
> > William Blake - Songs of Experience -1794 England
> >
>



-- 
--------------------------

Benedetti Alessandro
Visiting card - http://about.me/alessandro_benedetti
Blog - http://alexbenedetti.blogspot.co.uk

"Tyger, tyger burning bright
In the forests of the night,
What immortal hand or eye
Could frame thy fearful symmetry?"

William Blake - Songs of Experience -1794 England

Re: Grouping facets: Possible to get facet results for each Group?

Posted by Peter Sturge <pe...@gmail.com>.
Hi,
Thanks for your response.
I did have a look at pivots, and they could work in a way. We're still on
Solr 4.3, so I'll have to wait for sub-facets - but they sure look pretty
cool!
Peter


On Tue, Oct 13, 2015 at 12:30 PM, Alessandro Benedetti <
benedetti.alex85@gmail.com> wrote:

> Can you model your business domain with Solr nested Docs ? In the case you
> can use Yonik article about nested facets.
>
> Cheers
>
> On 13 October 2015 at 05:05, Alexandre Rafalovitch <ar...@gmail.com>
> wrote:
>
> > Could you use the new nested facets syntax?
> > http://yonik.com/solr-subfacets/
> >
> > Regards,
> >    Alex.
> > ----
> > Solr Analyzers, Tokenizers, Filters, URPs and even a newsletter:
> > http://www.solr-start.com/
> >
> > On 11 October 2015 at 09:51, Peter Sturge <pe...@gmail.com>
> wrote:
> > > Been trying to coerce Group faceting to give some faceting back for
> each
> > > group, but maybe this use case isn't catered for in Grouping? :
> > >
> > > So the Use Case is this:
> > > Let's say I do a grouped search that returns say, 9 distinct groups,
> and
> > in
> > > these groups are various numbers of unique field values that need
> > faceting
> > > - but the faceting needs to be within each group:
> >
>
>
>
> --
> --------------------------
>
> Benedetti Alessandro
> Visiting card - http://about.me/alessandro_benedetti
> Blog - http://alexbenedetti.blogspot.co.uk
>
> "Tyger, tyger burning bright
> In the forests of the night,
> What immortal hand or eye
> Could frame thy fearful symmetry?"
>
> William Blake - Songs of Experience -1794 England
>

Re: Grouping facets: Possible to get facet results for each Group?

Posted by Alessandro Benedetti <be...@gmail.com>.
Can you model your business domain with Solr nested Docs ? In the case you
can use Yonik article about nested facets.

Cheers

On 13 October 2015 at 05:05, Alexandre Rafalovitch <ar...@gmail.com>
wrote:

> Could you use the new nested facets syntax?
> http://yonik.com/solr-subfacets/
>
> Regards,
>    Alex.
> ----
> Solr Analyzers, Tokenizers, Filters, URPs and even a newsletter:
> http://www.solr-start.com/
>
> On 11 October 2015 at 09:51, Peter Sturge <pe...@gmail.com> wrote:
> > Been trying to coerce Group faceting to give some faceting back for each
> > group, but maybe this use case isn't catered for in Grouping? :
> >
> > So the Use Case is this:
> > Let's say I do a grouped search that returns say, 9 distinct groups, and
> in
> > these groups are various numbers of unique field values that need
> faceting
> > - but the faceting needs to be within each group:
>



-- 
--------------------------

Benedetti Alessandro
Visiting card - http://about.me/alessandro_benedetti
Blog - http://alexbenedetti.blogspot.co.uk

"Tyger, tyger burning bright
In the forests of the night,
What immortal hand or eye
Could frame thy fearful symmetry?"

William Blake - Songs of Experience -1794 England

Re: Grouping facets: Possible to get facet results for each Group?

Posted by Alexandre Rafalovitch <ar...@gmail.com>.
Could you use the new nested facets syntax? http://yonik.com/solr-subfacets/

Regards,
   Alex.
----
Solr Analyzers, Tokenizers, Filters, URPs and even a newsletter:
http://www.solr-start.com/

On 11 October 2015 at 09:51, Peter Sturge <pe...@gmail.com> wrote:
> Been trying to coerce Group faceting to give some faceting back for each
> group, but maybe this use case isn't catered for in Grouping? :
>
> So the Use Case is this:
> Let's say I do a grouped search that returns say, 9 distinct groups, and in
> these groups are various numbers of unique field values that need faceting
> - but the faceting needs to be within each group:

Fwd: Grouping facets: Possible to get facet results for each Group?

Posted by Peter Sturge <pe...@gmail.com>.
Hello Solr Forum,

Been trying to coerce Group faceting to give some faceting back for each
group, but maybe this use case isn't catered for in Grouping? :

So the Use Case is this:
Let's say I do a grouped search that returns say, 9 distinct groups, and in
these groups are various numbers of unique field values that need faceting
- but the faceting needs to be within each group:


user:*&facet=true&facet.field=user&group=true&group.field=host&group.facet=true

This query gives back grouped facets for each 'host' value (i.e. the facet
counts are 'collapsed') - but the facet counts (unique values of 'user'
field) are aggregated for all the groups, not on a 'per-group' basis (i.e.
returned as 'global facets' - outside of the grouped results).
The results from the query above doesn't say which unique values for
'users' are in which group. If the number of doc hits is very large (can
easily be in the 100's of thousands) it's not practical to iterate through
the docs looking for unique values.
This Use Case necessitates the unique values within each group, rather than
the total doc hits.

Is this possible with grouping, or inconjunction with another module?

Many thanks,
+Peter