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 gwk <gi...@eyefi.nl> on 2009/07/13 16:26:04 UTC

Faceting

Hi,

I'm in the process of making a javascriptless web interface to Solr (the 
nice ajax-version will be built on top of it unobtrusively). Our 
database has a lot of fields and so I've grouped those with similar 
characteristics to make several different 'widgets' (like a numerical 
type which get a min-max selector or an enumerated type with checkboxes) 
but I've run into a slight problem with fields which contain a lot of terms.
One of those fields is country, what I'd like to do is display the top X 
countries, which is easily done with 
facet.field=country&f.country.facet.limit=X and display a more link 
which will redirect to a new page with all countries (and other query 
parameters in hidden fields) which posts back to the search page. All 
this is no problem, but once a person has selected some countries which 
are not in the top X (say 'Narnia' and 'Guilder') I want to list that 
country below the X top countries with a checked checkbox. Is there a 
good way to select the top X facets and include some terms you want to 
include as well something like 
facet.field=country&f.country.facet.limit=X&f.country.facet.includeterms=Narnia,Guilder 
or is there some other way to achieve this?

Regards,

Gijs Kunze

Re: Faceting

Posted by gwk <gi...@eyefi.nl>.
Well, I had a bit of a facepalm moment when thinking about it a little 
more, I'll just show a "more countries [Y selected]" where Y is the 
number of countries selected which are not in the top X. If you want a 
nice concise interface you'll just have to enable javascript. With my 
earlier adventures in numerical range selection (solr-1240) I became 
wary of just adding facet.query parameters as Solr seemed to crash when 
adding a lot of facet.queries of the form facet.query=price:[* TO 
10]&facet.query:[10 TO 20] etc. etc

Thanks for your help,

Regards,

Gijs

Shalin Shekhar Mangar wrote:
> On Mon, Jul 13, 2009 at 7:56 PM, gwk <gi...@eyefi.nl> wrote:
>
>   
>> Is there a good way to select the top X facets and include some terms you
>> want to include as well something like
>> facet.field=country&f.country.facet.limit=X&f.country.facet.includeterms=Narnia,Guilder
>> or is there some other way to achieve this?
>>
>>     
>
> You can use facet.query for each of the terms you want to include. You may
> need to remove such terms from appearing in the facet.field=country results
> in the client.
>
> e.g.
> facet.field=country&f.country.facet.limit=X&facet.query=country:Narnia&facet.query=country:Guilder
>
>   


Re: Faceting

Posted by Shalin Shekhar Mangar <sh...@gmail.com>.
On Mon, Jul 13, 2009 at 7:56 PM, gwk <gi...@eyefi.nl> wrote:

>
> Is there a good way to select the top X facets and include some terms you
> want to include as well something like
> facet.field=country&f.country.facet.limit=X&f.country.facet.includeterms=Narnia,Guilder
> or is there some other way to achieve this?
>

You can use facet.query for each of the terms you want to include. You may
need to remove such terms from appearing in the facet.field=country results
in the client.

e.g.
facet.field=country&f.country.facet.limit=X&facet.query=country:Narnia&facet.query=country:Guilder

-- 
Regards,
Shalin Shekhar Mangar.