You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-dev@lucene.apache.org by Avlesh Singh <av...@gmail.com> on 2009/08/21 03:53:59 UTC

Multiple facet.prefix?

Should multiple values for facet.prefix be supported?
I have come across several use-cases on the user mailing list where such a
functionality could have helped (The latest one being -
http://www.lucidimagination.com/search/document/2a9c44d4f015b5e5/facet_filtering).
I ran into one such use last night.

Is there a general agreement on the enhancement?

Cheers
Avlesh

Re: Multiple facet.prefix?

Posted by Avlesh Singh <av...@gmail.com>.
Hmmm ... it went a long way than I thought :)

i think Avlesh is just suggesting that...
> facet.field=foo & f.foo.facet.prefix=a & f.foo.facet.prefix=z
>
You  are absolutely right, Hoss.

Until Yonik mentioned the "sort" behavior of facets, it never came into my
mind. My SQL analogy was .. "select ... where facet_field like "foo_%" or
facet_field like "bar_%" order by facetCount". Ordering between these was
something that I did not naturally desire. Its a nice to have thing for
sure.

Should I create a Jira issue for this enhancement?

Cheers
Avlesh

On Fri, Aug 21, 2009 at 11:04 AM, Chris Hostetter
<ho...@fucit.org>wrote:

>
> : Ah, yeah... in this case the client would be able to determine which
> : was which by the prefix of the label.  But it brings up interesting
> : points about ordering... should all of prefix "A" come before prefix
> : "B" or should they be sorted by frequency.  If it's the latter case,
>
> i don't see why the facet.sort param wouldn't dictate that, just like i
> would expect facet.limit to keep working.
>
> : then it seems like it's more the case of wanting an additional filter
> : applied to the facet, which we should also support at some point.
>
> it's just a simple matter of programming ... and hard matter of finding
> the time/energy.
>
>
>
> -Hoss
>
>

Re: Multiple facet.prefix?

Posted by Avlesh Singh <av...@gmail.com>.
Well, I have problems using the "filter" terminology. People who have
traditionally known the "facet.prefix" parameter would like to stick to
that. Having both of these might lead to confusion.
I have no problems with using local param syntax though. This should be
fine:
facet.field={!prefix=foo prefix=bar}myfield

Filtering within facets is a good idea but lets limit the scope of this
enhancement to multiple "facet.prefix" values for any facet.field.

Cheers
Avlesh

On Fri, Aug 21, 2009 at 11:54 AM, Yonik Seeley
<yo...@lucidimagination.com>wrote:

> On Fri, Aug 21, 2009 at 2:18 AM, Avlesh Singh<av...@gmail.com> wrote:
> > So, this is it -
> > facet.field=myField&f.foo.facet.prefix=foo&f.foo.facet.prefix=bar
> > Right?
>
> I'd actually prefer a more non-ambiguous and general syntax.
> It seems like you want to include a filter in faceting that you don't
> want applied to the normal search results (else you would have just
> used fq=myfield:(A* OR B*))
>
> So what about something like:
>
> facet.field={!filter="myfield:A* OR B*"}myfield
> or with dereferencing,
> facet.field={!filter=$f}myfield&f=myfield:A* OR B*
>
> -Yonik
> http://www.lucidimagination.com
>

Re: Multiple facet.prefix?

Posted by Yonik Seeley <yo...@lucidimagination.com>.
On Fri, Aug 21, 2009 at 2:18 AM, Avlesh Singh<av...@gmail.com> wrote:
> So, this is it -
> facet.field=myField&f.foo.facet.prefix=foo&f.foo.facet.prefix=bar
> Right?

I'd actually prefer a more non-ambiguous and general syntax.
It seems like you want to include a filter in faceting that you don't
want applied to the normal search results (else you would have just
used fq=myfield:(A* OR B*))

So what about something like:

facet.field={!filter="myfield:A* OR B*"}myfield
or with dereferencing,
facet.field={!filter=$f}myfield&f=myfield:A* OR B*

-Yonik
http://www.lucidimagination.com

Re: Multiple facet.prefix?

Posted by Avlesh Singh <av...@gmail.com>.
>
> So if you asked for the top 10, you would be fine with receiving all A* or
> all B* of those happened to be the top?  Or do you really want the top 10 A*
> and the top 10 B*?

For all use cases so far, yes.

No, that's just the thing - multiple prefixes specified this way would be
> the same logical facet.. hence no way to specify different limits, sorts, or
> whatever... those are per facet.
>
Awesome, we are all on the same page then.

So, this is it -
facet.field=myField&f.foo.facet.prefix=foo&f.foo.facet.prefix=bar
Right?

Cheers
Avlesh

On Fri, Aug 21, 2009 at 11:46 AM, Yonik Seeley
<yo...@lucidimagination.com>wrote:

> On Fri, Aug 21, 2009 at 2:10 AM, Avlesh Singh<av...@gmail.com> wrote:
> > Different ways to look at it Yonik. For things that I have needed this
> for,
> > so far (field:A* OR field:B*) was just as fine.
>
> So if you asked for the top 10, you would be fine with receiving all
> A* or all B* of those happened to be the top?  Or do you really want
> the top 10 A* and the top 10 B*?
>
> > Anyways, for me to file the ticket, what usage are we looking for? As
> > underneath?
> > facet.field=myField&f.foo.facet.prefix=foo&f.foo.facet.prefix=bar
> >
> > How would sort, limit and other parameters be passed? As underneath?
> > f.foo.facet.prefix.foo.sort=false&f.foo.facet.prefix.foo.limit=100
>
> No, that's just the thing - multiple prefixes specified this way would
> be the same logical facet.. hence no way to specify different limits,
> sorts, or whatever... those are per facet.
>
> -Yonik
> http://www.lucidimagination.com
>

Re: Multiple facet.prefix?

Posted by Yonik Seeley <yo...@lucidimagination.com>.
On Fri, Aug 21, 2009 at 2:10 AM, Avlesh Singh<av...@gmail.com> wrote:
> Different ways to look at it Yonik. For things that I have needed this for,
> so far (field:A* OR field:B*) was just as fine.

So if you asked for the top 10, you would be fine with receiving all
A* or all B* of those happened to be the top?  Or do you really want
the top 10 A* and the top 10 B*?

> Anyways, for me to file the ticket, what usage are we looking for? As
> underneath?
> facet.field=myField&f.foo.facet.prefix=foo&f.foo.facet.prefix=bar
>
> How would sort, limit and other parameters be passed? As underneath?
> f.foo.facet.prefix.foo.sort=false&f.foo.facet.prefix.foo.limit=100

No, that's just the thing - multiple prefixes specified this way would
be the same logical facet.. hence no way to specify different limits,
sorts, or whatever... those are per facet.

-Yonik
http://www.lucidimagination.com

Re: Multiple facet.prefix?

Posted by Avlesh Singh <av...@gmail.com>.
Different ways to look at it Yonik. For things that I have needed this for,
so far (field:A* OR field:B*) was just as fine.

Anyways, for me to file the ticket, what usage are we looking for? As
underneath?
facet.field=myField&f.foo.facet.prefix=foo&f.foo.facet.prefix=bar

How would sort, limit and other parameters be passed? As underneath?
f.foo.facet.prefix.foo.sort=false&f.foo.facet.prefix.foo.limit=100

Cheers
Avlesh

On Fri, Aug 21, 2009 at 11:20 AM, Yonik Seeley
<yo...@lucidimagination.com>wrote:

> Of course if you want the top 10 starting with "A" and the top 10
> starting with "B" then they are logically different facets.  It's not
> equivalent to including a filter of (field:A* OR field:B*).
>
> -Yonik
> http://www.lucidimagination.com
>

Re: Multiple facet.prefix?

Posted by Yonik Seeley <yo...@lucidimagination.com>.
Of course if you want the top 10 starting with "A" and the top 10
starting with "B" then they are logically different facets.  It's not
equivalent to including a filter of (field:A* OR field:B*).

-Yonik
http://www.lucidimagination.com

Re: Multiple facet.prefix?

Posted by Chris Hostetter <ho...@fucit.org>.
: Ah, yeah... in this case the client would be able to determine which
: was which by the prefix of the label.  But it brings up interesting
: points about ordering... should all of prefix "A" come before prefix
: "B" or should they be sorted by frequency.  If it's the latter case,

i don't see why the facet.sort param wouldn't dictate that, just like i 
would expect facet.limit to keep working.

: then it seems like it's more the case of wanting an additional filter
: applied to the facet, which we should also support at some point.

it's just a simple matter of programming ... and hard matter of finding 
the time/energy.



-Hoss


Re: Multiple facet.prefix?

Posted by Yonik Seeley <ys...@gmail.com>.
On Fri, Aug 21, 2009 at 1:02 AM, Chris
Hostetter<ho...@fucit.org> wrote:
>
> : > Or, may be just multiple facet.prefix values, Yonik; exactly the same as
> : > facet.field works.
> :
> : The problem then becomes labels.
> : facet.field=foo goes under the label "foo"
> :
> : We already have a mechanism to re-label results, seems like we should use that?
>
> i think Avlesh is just suggesting that...
>
>    facet.field=foo & f.foo.facet.prefix=a & f.foo.facet.prefix=z
>
> ...should result in a single facet.field result section for "foo" with the
> values that start with "a" and the values that start with "b"
>
> it seems like in an ideal world, both syntaxes would work -- the one above
> to make a single section, and the one below to have two seperate
> sections...

Ah, yeah... in this case the client would be able to determine which
was which by the prefix of the label.  But it brings up interesting
points about ordering... should all of prefix "A" come before prefix
"B" or should they be sorted by frequency.  If it's the latter case,
then it seems like it's more the case of wanting an additional filter
applied to the facet, which we should also support at some point.

-Yonik
http://www.lucidimagination.com

Re: Multiple facet.prefix?

Posted by Chris Hostetter <ho...@fucit.org>.
: > Or, may be just multiple facet.prefix values, Yonik; exactly the same as
: > facet.field works.
: 
: The problem then becomes labels.
: facet.field=foo goes under the label "foo"
: 
: We already have a mechanism to re-label results, seems like we should use that?

i think Avlesh is just suggesting that...

    facet.field=foo & f.foo.facet.prefix=a & f.foo.facet.prefix=z

...should result in a single facet.field result section for "foo" with the 
values that start with "a" and the values that start with "b"

it seems like in an ideal world, both syntaxes would work -- the one above 
to make a single section, and the one below to have two seperate 
sections...

: >> I think that once again, local params are the answer... the same as
: >> they were with faceting on a single field but excluding different
: >> filters.
: >>
: >> facet.field={!prefix=foo key=label1}myfield
: >> facet.field={!prefix=bar key=label2}myfield



-Hoss


Re: Multiple facet.prefix?

Posted by Yonik Seeley <ys...@gmail.com>.
On Thu, Aug 20, 2009 at 10:13 PM, Avlesh Singh<av...@gmail.com> wrote:
> Or, may be just multiple facet.prefix values, Yonik; exactly the same as
> facet.field works.

The problem then becomes labels.
facet.field=foo goes under the label "foo"

We already have a mechanism to re-label results, seems like we should use that?

-Yonik
http://www.lucidimagination.com

> Cheers
> Avlesh
>
> On Fri, Aug 21, 2009 at 7:39 AM, Yonik Seeley <yo...@lucidimagination.com>wrote:
>
>> On Thu, Aug 20, 2009 at 9:53 PM, Avlesh Singh<av...@gmail.com> wrote:
>> > Should multiple values for facet.prefix be supported?
>> > I have come across several use-cases on the user mailing list where such
>> a
>> > functionality could have helped (The latest one being -
>> >
>> http://www.lucidimagination.com/search/document/2a9c44d4f015b5e5/facet_filtering
>> ).
>> > I ran into one such use last night.
>> >
>> > Is there a general agreement on the enhancement?
>>
>> Yes, I think it's a good idea.
>> It's just that the current syntax doesn't quite support it yet.
>>
>> I think that once again, local params are the answer... the same as
>> they were with faceting on a single field but excluding different
>> filters.
>>
>> facet.field={!prefix=foo key=label1}myfield
>> facet.field={!prefix=bar key=label2}myfield
>>
>> -Yonik
>> http://www.lucidimagination.com
>>
>

Re: Multiple facet.prefix?

Posted by Avlesh Singh <av...@gmail.com>.
Or, may be just multiple facet.prefix values, Yonik; exactly the same as
facet.field works.

Cheers
Avlesh

On Fri, Aug 21, 2009 at 7:39 AM, Yonik Seeley <yo...@lucidimagination.com>wrote:

> On Thu, Aug 20, 2009 at 9:53 PM, Avlesh Singh<av...@gmail.com> wrote:
> > Should multiple values for facet.prefix be supported?
> > I have come across several use-cases on the user mailing list where such
> a
> > functionality could have helped (The latest one being -
> >
> http://www.lucidimagination.com/search/document/2a9c44d4f015b5e5/facet_filtering
> ).
> > I ran into one such use last night.
> >
> > Is there a general agreement on the enhancement?
>
> Yes, I think it's a good idea.
> It's just that the current syntax doesn't quite support it yet.
>
> I think that once again, local params are the answer... the same as
> they were with faceting on a single field but excluding different
> filters.
>
> facet.field={!prefix=foo key=label1}myfield
> facet.field={!prefix=bar key=label2}myfield
>
> -Yonik
> http://www.lucidimagination.com
>

Re: Multiple facet.prefix?

Posted by Yonik Seeley <yo...@lucidimagination.com>.
On Thu, Aug 20, 2009 at 9:53 PM, Avlesh Singh<av...@gmail.com> wrote:
> Should multiple values for facet.prefix be supported?
> I have come across several use-cases on the user mailing list where such a
> functionality could have helped (The latest one being -
> http://www.lucidimagination.com/search/document/2a9c44d4f015b5e5/facet_filtering).
> I ran into one such use last night.
>
> Is there a general agreement on the enhancement?

Yes, I think it's a good idea.
It's just that the current syntax doesn't quite support it yet.

I think that once again, local params are the answer... the same as
they were with faceting on a single field but excluding different
filters.

facet.field={!prefix=foo key=label1}myfield
facet.field={!prefix=bar key=label2}myfield

-Yonik
http://www.lucidimagination.com