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 "LT.thomas" <t....@itspree.pl> on 2011/11/14 11:02:27 UTC

Counting in facet results

Hi,

By counting in facet results I mean resolve the problem:

I have 7 documents:

A1   B1   C1
A2   B1   C1
A3   B2   C1
A4   B2   C2
A5   B3   C2
A6   B3   C2
A7   B3   C2

If I make the facet query by field B, get the result: B1=2, B2=2, B3=3.
A1   B1   C1
A2   B1   C1     2 - facing by B
--------------===
A3   B2   C1
A4   B2   C2     2 - facing by B
--------------===
A5   B3   C2
A6   B3   C2
A7   B3   C2     3 - facing by B

I wont to get additional information, something like count in results, by
field C. So, how can I query to get a result similar to the following:
A1   B1   C1
A2   B1   C1     2, 1 - facing by B, count C in facet results
--------------=====
A3   B2   C1
A4   B2   C2     2, 2 - facing by B, count C in facet results
--------------=====
A5   B3   C2
A6   B3   C2
A7   B3   C2     2, 1 - facing by B, count C in facet results


Thanks 

--
View this message in context: http://lucene.472066.n3.nabble.com/Counting-in-facet-results-tp3506382p3506382.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Counting in facet results

Posted by "LT.thomas" <t....@itspree.pl>.
I use Solandra that integrates Solr 3.4 with Cassandra. So, is there any way
to solve this problem with Solr 3.4 (without pivots)?

Your results are:
Cat: A=3
  SubCat: A1=2 and A2=1
Cat: B=2
  SubCat: A1=1 and B2=1

but I would like to have:
Cat: A=3
  SubCat: 2 (losing information about the numbers within A1 and A2, only
distinct count of subcategories)
Cat: B=2
  SubCat: 2 (losing information about the numbers within A1 and B2, only
distinct count of subcategories)

--
View this message in context: http://lucene.472066.n3.nabble.com/Counting-in-facet-results-tp3506382p3506848.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Counting in facet results

Posted by Samuel García Martínez <sa...@gmail.com>.
Hi, i think what you are looking for is "*nested facets*" or *
HierarchicalFaceting <http://wiki.apache.org/solr/HierarchicalFaceting>*
*
*
Category A - Subcategory A1
Category A - Subcategory A1
Category B - Subcategory A1
Category B - Subcategory B2
Category A - Subcategory A2

Faceting by Category:
 A: 3
 B: 2

In addition, pivoting this query:
Cat: A=3
  SubCat: A1=2 and A2=1
Cat: B=2
  SubCat: A1=1 and B2=1

This makes sense?

On Mon, Nov 14, 2011 at 11:02 AM, LT.thomas <t....@itspree.pl> wrote:

> Hi,
>
> By counting in facet results I mean resolve the problem:
>
> I have 7 documents:
>
> A1   B1   C1
> A2   B1   C1
> A3   B2   C1
> A4   B2   C2
> A5   B3   C2
> A6   B3   C2
> A7   B3   C2
>
> If I make the facet query by field B, get the result: B1=2, B2=2, B3=3.
> A1   B1   C1
> A2   B1   C1     2 - facing by B
> --------------===
> A3   B2   C1
> A4   B2   C2     2 - facing by B
> --------------===
> A5   B3   C2
> A6   B3   C2
> A7   B3   C2     3 - facing by B
>
> I wont to get additional information, something like count in results, by
> field C. So, how can I query to get a result similar to the following:
> A1   B1   C1
> A2   B1   C1     2, 1 - facing by B, count C in facet results
> --------------=====
> A3   B2   C1
> A4   B2   C2     2, 2 - facing by B, count C in facet results
> --------------=====
> A5   B3   C2
> A6   B3   C2
> A7   B3   C2     2, 1 - facing by B, count C in facet results
>
>
> Thanks
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/Counting-in-facet-results-tp3506382p3506382.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>



-- 
Un saludo,
Samuel García.