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 Jón Helgi Jónsson <jo...@gmail.com> on 2009/08/06 20:06:28 UTC

Summing sub categories in faceting

Hi, would really appreciate some help on this.

I'm doing a category browser for companies. Kind of like a yellow pages.

For each company I store each category the company is in like this:
Example for Boeing would be
03.03.02
which is an fictional id for 'Jets'

The beginning point I display all companies

My query: ?q=*:*&facet=true&facet.field=categoryID&facet.mincount=1

Desired facet result:
Shops and services (4313)         ID = 01
Home and interiour (2932)          ID = 02
Transportation (1144)                 ID = 03


I click Transportation, ID = 03

My query: ?q=*:*'&fq=categoryID:03*&facet=true&facet.field=categoryID&facet.mincount=1

Desired facet result:
Land vehicles (708)       ID = 03.01
Boats (391)                  ID = 03.02
Planes (342)                ID = 03.03

Under these categories are even more subcategories and so forth.

Using facet queries like above would give me count for every single
sub category which will be in the hundreds when I only really want the
sum of where I am in the hierarchical category tree at that.

Does this make sense?

My solution is to store multiple ID's for each company. Example for
Boeing would be to have a categoryFacet field and store 03 and 03.03
and 03.03.02, and skip the wildcard in the facet.field.

Seems kind of bloated, are there better solutions?

Thanks a bunch!

Re: Summing sub categories in faceting

Posted by Koji Sekiguchi <ko...@r.email.ne.jp>.
There is a patch for it:

https://issues.apache.org/jira/browse/SOLR-64

Koji


Jón Helgi Jónsson wrote:
> Did a bit more creative searching for a solution and came up with this:
>
> http://www.mail-archive.com/solr-user@lucene.apache.org/msg15027.html
>
> I'm using couple of days old nightly build, so unless there is
> something new I should know about I'm going with that method :)
>
> 2009/8/6 Jón Helgi Jónsson <jo...@gmail.com>:
>   
>> Hi, would really appreciate some help on this.
>>
>> I'm doing a category browser for companies. Kind of like a yellow pages.
>>
>> For each company I store each category the company is in like this:
>> Example for Boeing would be
>> 03.03.02
>> which is an fictional id for 'Jets'
>>
>> The beginning point I display all companies
>>
>> My query: ?q=*:*&facet=true&facet.field=categoryID&facet.mincount=1
>>
>> Desired facet result:
>> Shops and services (4313)         ID = 01
>> Home and interiour (2932)          ID = 02
>> Transportation (1144)                 ID = 03
>>
>>
>> I click Transportation, ID = 03
>>
>> My query: ?q=*:*'&fq=categoryID:03*&facet=true&facet.field=categoryID&facet.mincount=1
>>
>> Desired facet result:
>> Land vehicles (708)       ID = 03.01
>> Boats (391)                  ID = 03.02
>> Planes (342)                ID = 03.03
>>
>> Under these categories are even more subcategories and so forth.
>>
>> Using facet queries like above would give me count for every single
>> sub category which will be in the hundreds when I only really want the
>> sum of where I am in the hierarchical category tree at that.
>>
>> Does this make sense?
>>
>> My solution is to store multiple ID's for each company. Example for
>> Boeing would be to have a categoryFacet field and store 03 and 03.03
>> and 03.03.02, and skip the wildcard in the facet.field.
>>
>> Seems kind of bloated, are there better solutions?
>>
>> Thanks a bunch!
>>
>>     
>
>   


Re: Summing sub categories in faceting

Posted by Jón Helgi Jónsson <jo...@gmail.com>.
Did a bit more creative searching for a solution and came up with this:

http://www.mail-archive.com/solr-user@lucene.apache.org/msg15027.html

I'm using couple of days old nightly build, so unless there is
something new I should know about I'm going with that method :)

2009/8/6 Jón Helgi Jónsson <jo...@gmail.com>:
> Hi, would really appreciate some help on this.
>
> I'm doing a category browser for companies. Kind of like a yellow pages.
>
> For each company I store each category the company is in like this:
> Example for Boeing would be
> 03.03.02
> which is an fictional id for 'Jets'
>
> The beginning point I display all companies
>
> My query: ?q=*:*&facet=true&facet.field=categoryID&facet.mincount=1
>
> Desired facet result:
> Shops and services (4313)         ID = 01
> Home and interiour (2932)          ID = 02
> Transportation (1144)                 ID = 03
>
>
> I click Transportation, ID = 03
>
> My query: ?q=*:*'&fq=categoryID:03*&facet=true&facet.field=categoryID&facet.mincount=1
>
> Desired facet result:
> Land vehicles (708)       ID = 03.01
> Boats (391)                  ID = 03.02
> Planes (342)                ID = 03.03
>
> Under these categories are even more subcategories and so forth.
>
> Using facet queries like above would give me count for every single
> sub category which will be in the hundreds when I only really want the
> sum of where I am in the hierarchical category tree at that.
>
> Does this make sense?
>
> My solution is to store multiple ID's for each company. Example for
> Boeing would be to have a categoryFacet field and store 03 and 03.03
> and 03.03.02, and skip the wildcard in the facet.field.
>
> Seems kind of bloated, are there better solutions?
>
> Thanks a bunch!
>