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 Dan Field <do...@llgc.org.uk> on 2014/10/29 10:53:31 UTC

facet on field aliases of same field

Hi, we have a use case where we are trying to create multiple facet ranges based on a single field. 

I have successfully aliased the field by using the fl parameter e.g. fl=date_decade:date,date_year:date,date_month:date,date_day:date where date is the original field and the day_decade etc are the aliases. 

What I am failing to do is to create multiple facet ranges based on these aliased fields e.g:

&facet.field={!key=date_month ex=date_month}date_month&facet.field={!key=date_day ex=date_day}date&facet.range={!key=date_decade ex=date_decade}date_decade&facet.range={!key=date_year ex=date_year}date_year&f.date_decade.facet.range.start=1600-01-01T00:00:00Z&f.date_decade.facet.range.end=2000-01-01T00:00:00Z&f.date_decade.facet.range.gap=+10YEARS&f.date_year.facet.range.start=1600-01-01T00:00:00Z&f.date_year.facet.range.end=2000-01-01T00:00:00Z&f.date_year.facet.range.gap=+1YEARS"

We’re using Solarium here to generate the query and facet ranges but if we can do this in a raw HTTP request, that’s fine. I’m just not sure whether Solr will allow us to generate multiple facet ranges based on a single data field. Or am I approaching the problem in the wrong way?

Server is Solr 4.1

Any help appreciated

-- 
Dan Field <dof@llgc.org.uk <ma...@llgc.org.uk>>                   Ffôn/Tel. +44 1970 632 582
Pennaeth Uned Datblygu                        Head of Development Unit
Llyfrgell Genedlaethol Cymru                  National Library of Wales


Re: facet on field aliases of same field

Posted by Dan Field <do...@llgc.org.uk>.
Thanks Michael. We’re looking into the use of localparams now. 

> On 29 Oct 2014, at 12:56, Michael Ryan <mr...@moreover.com> wrote:
> 
> It is indeed possible. Just need to use a different syntax. As far as I know, the facet parameters need to be local parameters, like this...
> 
> &facet.range={!key=date_decade facet.range.start=1600-01-01T00:00:00Z facet.range.end=2000-01-01T00:00:00Z facet.range.gap=%2B10YEARS}date&facet.range={!key=date_year facet.range.start=1600-01-01T00:00:00Z facet.range.end=2000-01-01T00:00:00Z facet.range.gap=%2B1YEARS}date
> 
> -Michael
> 
> -----Original Message-----
> From: Dan Field [mailto:dof@llgc.org.uk] 
> Sent: Wednesday, October 29, 2014 5:54 AM
> To: solr-user@lucene.apache.org
> Subject: facet on field aliases of same field
> 
> Hi, we have a use case where we are trying to create multiple facet ranges based on a single field. 
> 
> I have successfully aliased the field by using the fl parameter e.g. fl=date_decade:date,date_year:date,date_month:date,date_day:date where date is the original field and the day_decade etc are the aliases. 
> 
> What I am failing to do is to create multiple facet ranges based on these aliased fields e.g:
> 
> &facet.field={!key=date_month ex=date_month}date_month&facet.field={!key=date_day ex=date_day}date&facet.range={!key=date_decade ex=date_decade}date_decade&facet.range={!key=date_year ex=date_year}date_year&f.date_decade.facet.range.start=1600-01-01T00:00:00Z&f.date_decade.facet.range.end=2000-01-01T00:00:00Z&f.date_decade.facet.range.gap=+10YEARS&f.date_year.facet.range.start=1600-01-01T00:00:00Z&f.date_year.facet.range.end=2000-01-01T00:00:00Z&f.date_year.facet.range.gap=+1YEARS"
> 
> We’re using Solarium here to generate the query and facet ranges but if we can do this in a raw HTTP request, that’s fine. I’m just not sure whether Solr will allow us to generate multiple facet ranges based on a single data field. Or am I approaching the problem in the wrong way?
> 
> Server is Solr 4.1
> 
> Any help appreciated
> 
> -- 
> Dan Field <dof@llgc.org.uk <ma...@llgc.org.uk>>                   Ffôn/Tel. +44 1970 632 582
> Pennaeth Uned Datblygu                        Head of Development Unit
> Llyfrgell Genedlaethol Cymru                  National Library of Wales
> 

-- 
Dan Field <dof@llgc.org.uk <ma...@llgc.org.uk>>                   Ffôn/Tel. +44 1970 632 582
Pennaeth Uned Datblygu                        Head of Development Unit
Llyfrgell Genedlaethol Cymru                  National Library of Wales


RE: facet on field aliases of same field

Posted by Michael Ryan <mr...@moreover.com>.
It is indeed possible. Just need to use a different syntax. As far as I know, the facet parameters need to be local parameters, like this...

&facet.range={!key=date_decade facet.range.start=1600-01-01T00:00:00Z facet.range.end=2000-01-01T00:00:00Z facet.range.gap=%2B10YEARS}date&facet.range={!key=date_year facet.range.start=1600-01-01T00:00:00Z facet.range.end=2000-01-01T00:00:00Z facet.range.gap=%2B1YEARS}date

-Michael

-----Original Message-----
From: Dan Field [mailto:dof@llgc.org.uk] 
Sent: Wednesday, October 29, 2014 5:54 AM
To: solr-user@lucene.apache.org
Subject: facet on field aliases of same field

Hi, we have a use case where we are trying to create multiple facet ranges based on a single field. 

I have successfully aliased the field by using the fl parameter e.g. fl=date_decade:date,date_year:date,date_month:date,date_day:date where date is the original field and the day_decade etc are the aliases. 

What I am failing to do is to create multiple facet ranges based on these aliased fields e.g:

&facet.field={!key=date_month ex=date_month}date_month&facet.field={!key=date_day ex=date_day}date&facet.range={!key=date_decade ex=date_decade}date_decade&facet.range={!key=date_year ex=date_year}date_year&f.date_decade.facet.range.start=1600-01-01T00:00:00Z&f.date_decade.facet.range.end=2000-01-01T00:00:00Z&f.date_decade.facet.range.gap=+10YEARS&f.date_year.facet.range.start=1600-01-01T00:00:00Z&f.date_year.facet.range.end=2000-01-01T00:00:00Z&f.date_year.facet.range.gap=+1YEARS"

We’re using Solarium here to generate the query and facet ranges but if we can do this in a raw HTTP request, that’s fine. I’m just not sure whether Solr will allow us to generate multiple facet ranges based on a single data field. Or am I approaching the problem in the wrong way?

Server is Solr 4.1

Any help appreciated

-- 
Dan Field <dof@llgc.org.uk <ma...@llgc.org.uk>>                   Ffôn/Tel. +44 1970 632 582
Pennaeth Uned Datblygu                        Head of Development Unit
Llyfrgell Genedlaethol Cymru                  National Library of Wales