An interesting analogy for this feature is that you're doing a count(*) on a 
group by in SQL. While it's true that you can pre-compute these if you have a 
small set of combination you know you want to show a-priori, if you want to 
present a more dynamic customer experience, you need to be able to run these on 
arbitrary combination of fields at query time. I would like to see support for 
aggregating functions beyond just a count. Here's a sample list of what's 
available in mysql: 
http://dev.mysql.com/doc/refman/5.0/en/group-by-functions.html

Looking at the patch in SOLR-792, it doesn't look terribly difficult to add 
function level abstraction and to go beyond 2 levels. I have some code that 
does this but it's implemented as an ant task and wired to a CSV parser. I'll 
see what it would take to refactor it...

What would you imagine the query looking like if functions were added?

http://localhost:8983/solr/select?q=*:*&rows=0&facet=on&facet.field=cat&facet.tree=cat,inStock{count},price{min,average,max}&wt=json&indent=on

It also gets very interesting when you want to start filtering, sorting and 
managing response sizes on the facet values such as this quickly contrived 
example: facet.tree=cat,inStock{return the first 10 counts greater than 5 
descending sorted}

Brian





________________________________
From: ashokcz <ashokkumar.gane...@tcs.com>
To: solr-user@lucene.apache.org
Sent: Thursday, July 16, 2009 3:22:48 AM
Subject: Re: Getting Facet Count of combination of fields


hmmm but in my case it will be dynamic . they may choose different fields at
run time and accordingly i need to populate the values ...

Avlesh Singh wrote:
> 
> If you create a field called "brand_year_of_manufacturing" and populate it
> with the "brandName - YOM" data while indexing, you can achieve the
> desired
> with a simple facet on this field.
> 
> Cheers
> Avlesh
> 
> On Thu, Jul 16, 2009 at 1:19 PM, ashokcz <ashokkumar.gane...@tcs.com>
> wrote:
> 
>>
>> Hi all,
>> i have a scenario where i need to get facet count for combination of
>> fields.
>> Say i have two fields Manufacturer and Year of manufacture.
>> I search for something and it gives me 15 results and my facet count as
>> like
>> this :
>> Manufacturer           : Nokia(5);Motorola(7);iphone(3)
>> Year of manufacture : 2007 (4) ; 2008 (4) 2009 (7).
>> But what i need is combination of count .
>> Say
>> Nokia - 2007 - 1
>> Nokia - 2008 - 1
>> Nokia - 2009 - 2
>>
>> Somethig like this ........
>>
>>
>> is there any way we can get this kind of facet counts from single solr
>> search hits ???
>>
>>
>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Getting-Facet-Count-of-combination-of-fields-tp24511923p24511923.html
>> Sent from the Solr - User mailing list archive at Nabble.com.
>>
>>
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Getting-Facet-Count-of-combination-of-fields-tp24511923p24513837.html
Sent from the Solr - User mailing list archive at Nabble.com.

Reply via email to