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 Brendan Grainger <br...@gmail.com> on 2013/05/14 17:09:26 UTC

Facets referenced by key

Hi All,

I'm creating 2 distinct sets of facet results using a key local param, e.g.:

facet.field={!ex=dt key=my_facet_key}the_facet_field&facet.field={!ex=dt
key=some_other_facet_key}the_facet_field

I would then like to refer to these 'pseudo' field later in the request
string. I thought this would be how I'd do it:

f.my_facet_key.facet.prefix=a_given_prefix

and

f.my_other_facet_key.prefix=a_different_prefix

So the whole thing would look like (With as similar request string for the
my_other_facet):

facet.field={!ex=dt
key=my_facet_key}the_facet_field&f.my_facet_key.facet.prefix=a_given_prefix


I thought this would work, however it doesn't appear to. What does work is
if I define the prefix and mincount in the local params:

facet.field={!ex=dt key=my_facet_key
facet.prefix=a_given_prefix}the_facet_field

Is this expected? I'm also using sunspot and they construct the queries
with keys as in my first example, i.e. facet.field={!ex=dt
key=my_facet_key}the_facet_field&f.my_facet_key.facet.prefix=a_given_prefix


Thanks
Brendan

-- 
Brendan Grainger
www.kuripai.com

Re: Facets referenced by key

Posted by Brendan Grainger <br...@gmail.com>.
Thanks for the excellent clarification. I'll ask the sunspot guys about the localparams issue. I have a patch that would fix it

Thanks 
Brendan

On May 16, 2013, at 1:42 PM, Chris Hostetter <ho...@fucit.org> wrote:

> 
> : I would then like to refer to these 'pseudo' field later in the request
> : string. I thought this would be how I'd do it:
> : 
> : f.my_facet_key.facet.prefix=a_given_prefix
>    ...
> 
> 
> that syntax was proposed in SOLR-1351 and a patch was made available, but 
> it was never commited (it only supported a subset of faceting, needed more 
> tests, and had unclear behavior about how the defaults where picked if 
> you combined f.key.facet.foo + f.field.facet.foo + facet.foo)
> 
> : I thought this would work, however it doesn't appear to. What does work is
> : if I define the prefix and mincount in the local params:
> : 
> : facet.field={!ex=dt key=my_facet_key facet.prefix=a_given_prefix}the_facet_field
> 
> Correct, SOLR-4717 added support to Solr 4.3 for specifying all of the 
> facet options as local params such that that syntax would work.  Given th 
> way the use of Solr and localparams have evolved over the years it was 
> considered a more natural and logical way to specify facet option on a per 
> field or per key basis.
> 
> : Is this expected? I'm also using sunspot and they construct the queries
> : with keys as in my first example, i.e. facet.field={!ex=dt
> : key=my_facet_key}the_facet_field&f.my_facet_key.facet.prefix=a_given_prefix
> 
> I can't comment on that ... i'm not sure why sunspot would assume that 
> behavior would work (unless someone looked at SOLR-1351 once upon a time 
> and assumed that would definitely be official at some point)
> 
> -Hoss

Re: Facets referenced by key

Posted by Chris Hostetter <ho...@fucit.org>.
: I would then like to refer to these 'pseudo' field later in the request
: string. I thought this would be how I'd do it:
: 
: f.my_facet_key.facet.prefix=a_given_prefix
	...


that syntax was proposed in SOLR-1351 and a patch was made available, but 
it was never commited (it only supported a subset of faceting, needed more 
tests, and had unclear behavior about how the defaults where picked if 
you combined f.key.facet.foo + f.field.facet.foo + facet.foo)

: I thought this would work, however it doesn't appear to. What does work is
: if I define the prefix and mincount in the local params:
: 
: facet.field={!ex=dt key=my_facet_key facet.prefix=a_given_prefix}the_facet_field

Correct, SOLR-4717 added support to Solr 4.3 for specifying all of the 
facet options as local params such that that syntax would work.  Given th 
way the use of Solr and localparams have evolved over the years it was 
considered a more natural and logical way to specify facet option on a per 
field or per key basis.

: Is this expected? I'm also using sunspot and they construct the queries
: with keys as in my first example, i.e. facet.field={!ex=dt
: key=my_facet_key}the_facet_field&f.my_facet_key.facet.prefix=a_given_prefix

I can't comment on that ... i'm not sure why sunspot would assume that 
behavior would work (unless someone looked at SOLR-1351 once upon a time 
and assumed that would definitely be official at some point)

-Hoss