Multiple Facets on Same Field

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Multiple Facets on Same Field

Jason Gerlowski
Hi all,

Is it possible to have multiple facets on the same field with
different parameters (mincount, limit, prefix, etc.) on each?

The ref-guide describes these per-facet parameters as being settable
on a "per-field basis" with syntax of
"f.<fieldname>.facet.<parameter>" [1].  But I wasn't sure whether to
take that at face value, or hope that the "<fieldname>" value there
could be something more flexible (like the value of facet.field which
can take local params).

I've been trying variations of
"facet=true&facet.field=f1&f.f1.facet.mincount=5&facet.field={!key=someOutputKey}f1",
but without luck.  "mincount" is always applied to both of the
facet.field's being computed.

Best,

Jason
Reply | Threaded
Open this post in threaded view
|

Re: Multiple Facets on Same Field

Michael Gibney
Answering a slightly different question perhaps, but you can
definitely do this with the "JSON Facet" API, where there's much
cleaner separation between different facets (and output is assigned to
arbitrary keys).
Michael

On Tue, Nov 17, 2020 at 9:36 AM Jason Gerlowski <[hidden email]> wrote:

>
> Hi all,
>
> Is it possible to have multiple facets on the same field with
> different parameters (mincount, limit, prefix, etc.) on each?
>
> The ref-guide describes these per-facet parameters as being settable
> on a "per-field basis" with syntax of
> "f.<fieldname>.facet.<parameter>" [1].  But I wasn't sure whether to
> take that at face value, or hope that the "<fieldname>" value there
> could be something more flexible (like the value of facet.field which
> can take local params).
>
> I've been trying variations of
> "facet=true&facet.field=f1&f.f1.facet.mincount=5&facet.field={!key=someOutputKey}f1",
> but without luck.  "mincount" is always applied to both of the
> facet.field's being computed.
>
> Best,
>
> Jason
Reply | Threaded
Open this post in threaded view
|

Re: Multiple Facets on Same Field

Jason Gerlowski
Thanks Michael,

I agree - JSON Facets is a better candidate for the functionality I'm
looking for.  In my case specifically though, I think I'm pegged to
traditional facets because I also want to use the "terms" local params
support that doesn't have a native equivalent in JSON Faceting (yet:
SOLR-14921).

If no one has other ideas here, maybe my best bet is to switch to
using JSON Faceting and adding an explicit "{!terms}" query as a
filter.  I see you suggested that as a workaround here [1].

Jason

[1] http://mail-archives.apache.org/mod_mbox/lucene-dev/202010.mbox/%3CCAF%3DheHGKwGtvq%3DgAndmVrgvo1cxKmzP0neGi17_eoVhubpaBZA%40mail.gmail.com%3E

On Tue, Nov 17, 2020 at 10:02 AM Michael Gibney
<[hidden email]> wrote:

>
> Answering a slightly different question perhaps, but you can
> definitely do this with the "JSON Facet" API, where there's much
> cleaner separation between different facets (and output is assigned to
> arbitrary keys).
> Michael
>
> On Tue, Nov 17, 2020 at 9:36 AM Jason Gerlowski <[hidden email]> wrote:
> >
> > Hi all,
> >
> > Is it possible to have multiple facets on the same field with
> > different parameters (mincount, limit, prefix, etc.) on each?
> >
> > The ref-guide describes these per-facet parameters as being settable
> > on a "per-field basis" with syntax of
> > "f.<fieldname>.facet.<parameter>" [1].  But I wasn't sure whether to
> > take that at face value, or hope that the "<fieldname>" value there
> > could be something more flexible (like the value of facet.field which
> > can take local params).
> >
> > I've been trying variations of
> > "facet=true&facet.field=f1&f.f1.facet.mincount=5&facet.field={!key=someOutputKey}f1",
> > but without luck.  "mincount" is always applied to both of the
> > facet.field's being computed.
> >
> > Best,
> >
> > Jason
Reply | Threaded
Open this post in threaded view
|

Re: Multiple Facets on Same Field

Michael Gibney
Ah, ok! The Jira issue mentioned in the mail thread you cited above
has some further discussion/detail. (I don't think adding a "{!terms}"
query filter would necessarily work ... it'd need to be a group of
facets of type "query", sorted client-side ... unless I'm missing
something?)
https://issues.apache.org/jira/browse/SOLR-14921


On Tue, Nov 17, 2020 at 11:00 AM Jason Gerlowski <[hidden email]> wrote:

>
> Thanks Michael,
>
> I agree - JSON Facets is a better candidate for the functionality I'm
> looking for.  In my case specifically though, I think I'm pegged to
> traditional facets because I also want to use the "terms" local params
> support that doesn't have a native equivalent in JSON Faceting (yet:
> SOLR-14921).
>
> If no one has other ideas here, maybe my best bet is to switch to
> using JSON Faceting and adding an explicit "{!terms}" query as a
> filter.  I see you suggested that as a workaround here [1].
>
> Jason
>
> [1] http://mail-archives.apache.org/mod_mbox/lucene-dev/202010.mbox/%3CCAF%3DheHGKwGtvq%3DgAndmVrgvo1cxKmzP0neGi17_eoVhubpaBZA%40mail.gmail.com%3E
>
> On Tue, Nov 17, 2020 at 10:02 AM Michael Gibney
> <[hidden email]> wrote:
> >
> > Answering a slightly different question perhaps, but you can
> > definitely do this with the "JSON Facet" API, where there's much
> > cleaner separation between different facets (and output is assigned to
> > arbitrary keys).
> > Michael
> >
> > On Tue, Nov 17, 2020 at 9:36 AM Jason Gerlowski <[hidden email]> wrote:
> > >
> > > Hi all,
> > >
> > > Is it possible to have multiple facets on the same field with
> > > different parameters (mincount, limit, prefix, etc.) on each?
> > >
> > > The ref-guide describes these per-facet parameters as being settable
> > > on a "per-field basis" with syntax of
> > > "f.<fieldname>.facet.<parameter>" [1].  But I wasn't sure whether to
> > > take that at face value, or hope that the "<fieldname>" value there
> > > could be something more flexible (like the value of facet.field which
> > > can take local params).
> > >
> > > I've been trying variations of
> > > "facet=true&facet.field=f1&f.f1.facet.mincount=5&facet.field={!key=someOutputKey}f1",
> > > but without luck.  "mincount" is always applied to both of the
> > > facet.field's being computed.
> > >
> > > Best,
> > >
> > > Jason