Ok, assuming sku is an un-tokenized field (and if it isn't, use
a copyField) then just facet on that field. Then, at the app layer,
combine them to get your aggregate counts.

So your raw return would have
Audi A4 (2)
Audi A5 (1)
Audi S8 (2)
Volvo V50 (1)

The app would have to be smart enough to spin through the "sku" facet
and "just know" that the three Audi SKUs need to be rolled up into one
"Audi" entry..... This could be simple if the rule were that the SKU always
started with the brand name....

And similarly for the other SKUs.


Crude, but it'd work.

Best
Erick

On Tue, Mar 20, 2012 at 4:01 PM, rasser <r...@vertica.dk> wrote:
> Thanks for taking the time to help me Erick!
>
> Just to clarify my desired behavior from the facets. This is the index,
> notice color is multivalued to represent a model of car that has more than
> one color:
>
> <doc>
> <field name="sku">Audi A4</field>
> <field name="brand">audi</field>
> <field name="variant_id">A4_black</field>
> <field name="color">black</field>
> <field name="color">white</field>
> </doc>
> <doc>
> <field name="sku">Audi A4</field>
> <field name="brand">audi</field>
> <field name="variant_id">A4_white</field>
> <field name="color">white</field>
> </doc>
> <doc>
> <field name="sku">Volvo V50</field>
> <field name="brand">volvo</field>
> <field name="variant_id">Volvo_V50</field>
> <field name="color">black</field>
> </doc>
> <doc>
> <field name="sku">Audi A5</field>
> <field name="brand">audi</field>
> <field name="variant_id">A5_white</field>
> <field name="color">white</field>
> </doc>
> <doc>
> <field name="sku">Audi S8</field>
> <field name="brand">audi</field>
> <field name="variant_id">S8_yellow</field>
> <field name="color">yellow</field>
> </doc>
> <doc>
> <field name="sku">Audi S8</field>
> <field name="brand">audi</field>
> <field name="variant_id">S8_black</field>
> <field name="color">black</field>
> <field name="color">white</field>
> </doc>
>
> My goal is to to get this facet:
> brand
> -------------
> audi (3)  -> since there are 3 audi models (A4,A5 and S8)
> volvo (1) -> since there is only one volvo model (V50)
>
> color
> -------------
> black (3) -> since all models except except A5 is available in black
> white (3) -> since A4,A5 and S8 is available in white
> yellow (1) -> since only S8 is available in yellow
>
> And these 4 results (when query is *:*)
>
> - Audi A4
> - Audi A5
> - Audi S8
> - Volvo V50
>
>
> Thanks
>
> --
> View this message in context: 
> http://lucene.472066.n3.nabble.com/To-truncate-or-not-to-truncate-group-truncate-vs-facet-tp3838797p3843596.html
> Sent from the Solr - User mailing list archive at Nabble.com.

Reply via email to