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 Rasmus Østergård <ro...@vertica.dk> on 2012/03/19 10:22:21 UTC

To truncate or not to truncate (group.truncate vs. facet)

I have an index that contains variants of cars. In this small sample I have 2 car models (Audi and Volvo) and the Audi is available in black or white, whereas the Volvo is only available in black.

On the search page I want to display products not variants - in this test case 2 products should be shown: "Audi A4" and "Volvo V50"

I'm having trouble achieving the desired count in my search facets.

This is my test schema:

<fields>
   <field name=" variant_id" type="string" indexed="true" stored="true" required="true" />
   <field name="sku" type="string" indexed="true" stored="true" />
   <field name="color" type="string" indexed="true" stored="true"/>
 </fields>
<uniqueKey>variant_id</uniqueKey>

Test data:

<doc>
<field name="sku">Audi A4</field>
<field name="brand">audi</field>
<!-- Variant properties -->
<field name="variant_id">A4_black</field>
<field name="color">black</field>
</doc>
<doc>
<field name="sku">Audi A4</field>
<field name="brand">audi</field>
<!-- Variant properties -->
<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>
<!-- Variant properties -->
<field name="variant_id">Volvo_V50</field>
<field name="color">black</field>
</doc>

My goal is to to get this facet:
brand
-------------
audi (1)
volvo (1)

color
-------------
black (2)
white (1)


I'm trying to use group.truncate to do this but fails.

This is my search query when not truncating:
/select?facet.field=color&facet.field=brand&defType=edixmax&facet=true&group=true&group.field=sku&group.truncate=false

brand
-------------
audi (2)
volvo (1)

color
-------------
black (2)
white (1)


This is my search query when doing truncating:
/select?facet.field=color&facet.field=brand&defType=edixmax&facet=true&group=true&group.field=sku&group.truncate=true

brand
-------------
audi (1)
volvo (1)

color
-------------
black (2)
white (0)


As can be seen none of the 2 above match my desire.
The problem seems to be that I want trucating on only selected facets. I this posible?

Thanks!

Re: To truncate or not to truncate (group.truncate vs. facet)

Posted by danjfoley <da...@micamedia.com>.
Good idea. In fact you could fake anything this way. Pre-render the facet
values on input.

On Tue, Apr 10, 2012 at 1:58 PM, Young, Cody [via Lucene] <
ml-node+s472066n3900432h41@n3.nabble.com> wrote:

> You may be able to fake your price requirements by rounding at index time.
>
> For instance, if you wanted 10-19$, 20-29$, 30+ then you create a second
> price field specifically for faceting, round down to 10, 20, 30 at index
> time and then facet on that field.
>
> Cody
>
> -----Original Message-----
> From: danjfoley [mailto:[hidden email]<http://user/SendEmail.jtp?type=node&node=3900432&i=0>]
>
> Sent: Monday, April 09, 2012 7:26 PM
> To: [hidden email] <http://user/SendEmail.jtp?type=node&node=3900432&i=1>
> Subject: Re: To truncate or not to truncate (group.truncate vs. facet)
>
> Is this planned as a future feature? Is it in the bug tracker as a feature
> yet..just wondering how long until it is a feature.  I could live without
> price counts for a bit.
>
> Sent from my phone
>
> ----- Reply message -----
> From: "Martijn v Groningen-2 [via Lucene]" <[hidden email]<http://user/SendEmail.jtp?type=node&node=3900432&i=2>>
>
> Date: Mon, Apr 9, 2012 3:31 pm
> Subject: To truncate or not to truncate (group.truncate vs. facet)
> To: "danjfoley" <[hidden email]<http://user/SendEmail.jtp?type=node&node=3900432&i=3>>
>
>
>
>
> The group.facet option only works for field facets (facet.field). Others
> facets types (query, range and pivot) aren't supported yet.
> The group.facet works for both single and multivalued fields specified in
> the facet.field parameter.
>
> Martijn
>
> On 9 April 2012 20:58, danjfoley <[hidden email]<http://user/SendEmail.jtp?type=node&node=3900432&i=4>>
> wrote:
>
> > I am using group.facet and it works fine for regular facet.field but
> > not for facet.query
> >
> > Sent from my phone
> >
> > ----- Reply message -----
> > From: "Young, Cody [via Lucene]"
> > <[hidden email] <http://user/SendEmail.jtp?type=node&node=3900432&i=5>
> > >
> > Date: Mon, Apr 9, 2012 1:38 pm
> > Subject: To truncate or not to truncate (group.truncate vs. facet)
> > To: "danjfoley" <[hidden email]<http://user/SendEmail.jtp?type=node&node=3900432&i=6>>
>
> >
> >
> >
> > One other thing, I believe that you need to be using facet.field on
> > single valued string fields for group.facet to function properly. Are
> > the fields you're faceting on multiValued=false?
> >
> > Cody
> >
> > -----Original Message-----
> > From: Young, Cody [mailto:[hidden email]<http://user/SendEmail.jtp?type=node&node=3900432&i=7>]
>
> > Sent: Monday, April 09, 2012 10:36 AM
> > To: [hidden email]<http://user/SendEmail.jtp?type=node&node=3900432&i=8>
> > Subject: RE: To truncate or not to truncate (group.truncate vs. facet)
> >
> > You tried adding the parameter
> >
> > &group.facet=true ?
> >
> > Cody
> >
> > -----Original Message-----
> > From: danjfoley [mailto:[hidden email]<http://user/SendEmail.jtp?type=node&node=3900432&i=9>]
>
> > Sent: Monday, April 09, 2012 10:09 AM
> > To: [hidden email]<http://user/SendEmail.jtp?type=node&node=3900432&i=10>
> > Subject: Re: To truncate or not to truncate (group.truncate vs. facet)
> >
> > I did get this working with version 4. However my facet queries still
> > don't group.
> >
> > Sent from my phone
> >
> > ----- Reply message -----
> > From: "Young, Cody [via Lucene]"
> > <[hidden email] <http://user/SendEmail.jtp?type=node&node=3900432&i=11>
> > >
> > Date: Mon, Apr 9, 2012 12:45 pm
> > Subject: To truncate or not to truncate (group.truncate vs. facet)
> > To: "danjfoley" <[hidden email]<http://user/SendEmail.jtp?type=node&node=3900432&i=12>>
>
> >
> >
> >
> > I believe you're looking for what's called, "Matrix Counts"
> >
> > Please see this JIRA issue. To my knowledge it has been committed in
> > trunk but not 3.x.
> >
> > https://issues.apache.org/jira/browse/SOLR-2898
> >
> > This feature is accessed by using group.facet=true
> >
> > Cody
> >
> > -----Original Message-----
> > From: danjfoley [mailto:[hidden email]<http://user/SendEmail.jtp?type=node&node=3900432&i=13>]
>
> > Sent: Saturday, April 07, 2012 7:02 PM
> > To: [hidden email]<http://user/SendEmail.jtp?type=node&node=3900432&i=14>
> > Subject: Re: To truncate or not to truncate (group.truncate vs. facet)
> >
> > I've been searching for a solution to my issue, and this seems to come
> > closest to it. But not exactly.
> >
> > I am indexing clothing. Each article of clothing comes in many sizes
> > and colors, and can belong to any number of categories.
> >
> > For example take the following: I add 6 documents to solr as follows:
> >
> > product, color, size, category
> >
> > shirt A, red, small, valentines day
> > shirt A, red, large, valentines day
> > shirt A, blue, small, valentines day
> > shirt A, blue, large, valentines day
> > shirt A, green, small, valentines day
> > shirt A, green, large, valentines day
> >
> > I'd like my facet counts to return as follows:
> >
> > color
> >
> > red (1)
> > blue (1)
> > green (1)
> >
> > size
> >
> > small (1)
> > large (1)
> >
> > category
> >
> > valentines day (1)
> >
> > But they come back like this:
> >
> > color:
> > red (2)
> > blue (2)
> > green (2)
> >
> > size:
> > small (2)
> > large (2)
> >
> > category
> > valentines day (6)
> >
> > I see the group.facet parameter in version 4.0 does exactly this.
> > However how can I make this happen now? There are all sorts of
> > ecommerce systems out there that facet exactly how i'm asking. i
> > thought solr is supposed to be the very best fastest search system,
> > yet it doesn't seem to be able to facet correct for items with multiple
> values?
> >
> > Am i indexing my data wrong?
> >
> > how can i make this happen?
> >
> > --
> > View this message in context:
> > http://lucene.472066.n3.nabble.com/To-truncate-or-not-to-truncate-grou
> > p-truncate-vs-facet-tp3838797p3893744.html
> > Sent from the Solr - User mailing list archive at Nabble.com.
> >
> >
> > _______________________________________________
> > If you reply to this email, your message will be added to the
> > discussion
> > below:
> >
> > http://lucene.472066.n3.nabble.com/To-truncate-or-not-to-truncate-grou
> > p-truncate-vs-facet-tp3838797p3897366.html
> >
> > To unsubscribe from To truncate or not to truncate (group.truncate vs.
> > facet, visit
> > http://lucene.472066.n3.nabble.com/template/NamlServlet.jtp?macro=unsu
> > bscribe_by_code&node=3838797&code=ZGFuQG1pY2FtZWRpYS5jb218MzgzODc5N3wt
> > MTEyNjQzODIyNg==
> >
> > --
> > View this message in context:
> > http://lucene.472066.n3.nabble.com/To-truncate-or-not-to-truncate-grou
> > p-truncate-vs-facet-tp3838797p3897422.html
> > Sent from the Solr - User mailing list archive at Nabble.com.
> >
> >
> > _______________________________________________
> > If you reply to this email, your message will be added to the
> > discussion
> > below:
> >
> > http://lucene.472066.n3.nabble.com/To-truncate-or-not-to-truncate-grou
> > p-truncate-vs-facet-tp3838797p3897487.html
> >
> > To unsubscribe from To truncate or not to truncate (group.truncate vs.
> > facet, visit
> > http://lucene.472066.n3.nabble.com/template/NamlServlet.jtp?macro=unsu
> > bscribe_by_c
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/To-truncate-or-not-to-truncate-group-truncate-vs-facet-tp3838797p3898537.html
>
> Sent from the Solr - User mailing list archive at Nabble.com.
>
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://lucene.472066.n3.nabble.com/To-truncate-or-not-to-truncate-group-truncate-vs-facet-tp3838797p3900432.html
>  To unsubscribe from To truncate or not to truncate (group.truncate vs.
> facet), click here<http://lucene.472066.n3.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=3838797&code=ZGFuQG1pY2FtZWRpYS5jb218MzgzODc5N3wtMTEyNjQzODIyNg==>
> .
> NAML<http://lucene.472066.n3.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>



-- 
Dan Foley
Owner - PHP Web Developer
_______________________________________________________
Micamedia.com - PHP Web Development


--
View this message in context: http://lucene.472066.n3.nabble.com/To-truncate-or-not-to-truncate-group-truncate-vs-facet-tp3838797p3900517.html
Sent from the Solr - User mailing list archive at Nabble.com.

RE: To truncate or not to truncate (group.truncate vs. facet)

Posted by "Young, Cody" <Co...@move.com>.
You may be able to fake your price requirements by rounding at index time.

For instance, if you wanted 10-19$, 20-29$, 30+ then you create a second price field specifically for faceting, round down to 10, 20, 30 at index time and then facet on that field.

Cody

-----Original Message-----
From: danjfoley [mailto:dan@micamedia.com] 
Sent: Monday, April 09, 2012 7:26 PM
To: solr-user@lucene.apache.org
Subject: Re: To truncate or not to truncate (group.truncate vs. facet)

Is this planned as a future feature? Is it in the bug tracker as a feature yet..just wondering how long until it is a feature.  I could live without price counts for a bit.

Sent from my phone

----- Reply message -----
From: "Martijn v Groningen-2 [via Lucene]" <ml...@n3.nabble.com>
Date: Mon, Apr 9, 2012 3:31 pm
Subject: To truncate or not to truncate (group.truncate vs. facet)
To: "danjfoley" <da...@micamedia.com>



The group.facet option only works for field facets (facet.field). Others facets types (query, range and pivot) aren't supported yet.
The group.facet works for both single and multivalued fields specified in the facet.field parameter.

Martijn

On 9 April 2012 20:58, danjfoley <da...@micamedia.com> wrote:

> I am using group.facet and it works fine for regular facet.field but 
> not for facet.query
>
> Sent from my phone
>
> ----- Reply message -----
> From: "Young, Cody [via Lucene]" 
> <ml-node+s472066n3897487h46@n3.nabble.com
> >
> Date: Mon, Apr 9, 2012 1:38 pm
> Subject: To truncate or not to truncate (group.truncate vs. facet)
> To: "danjfoley" <da...@micamedia.com>
>
>
>
> One other thing, I believe that you need to be using facet.field on 
> single valued string fields for group.facet to function properly. Are 
> the fields you're faceting on multiValued=false?
>
> Cody
>
> -----Original Message-----
> From: Young, Cody [mailto:Cody.Young@move.com]
> Sent: Monday, April 09, 2012 10:36 AM
> To: solr-user@lucene.apache.org
> Subject: RE: To truncate or not to truncate (group.truncate vs. facet)
>
> You tried adding the parameter
>
> &group.facet=true ?
>
> Cody
>
> -----Original Message-----
> From: danjfoley [mailto:dan@micamedia.com]
> Sent: Monday, April 09, 2012 10:09 AM
> To: solr-user@lucene.apache.org
> Subject: Re: To truncate or not to truncate (group.truncate vs. facet)
>
> I did get this working with version 4. However my facet queries still 
> don't group.
>
> Sent from my phone
>
> ----- Reply message -----
> From: "Young, Cody [via Lucene]" 
> <ml-node+s472066n3897366h95@n3.nabble.com
> >
> Date: Mon, Apr 9, 2012 12:45 pm
> Subject: To truncate or not to truncate (group.truncate vs. facet)
> To: "danjfoley" <da...@micamedia.com>
>
>
>
> I believe you're looking for what's called, "Matrix Counts"
>
> Please see this JIRA issue. To my knowledge it has been committed in 
> trunk but not 3.x.
>
> https://issues.apache.org/jira/browse/SOLR-2898
>
> This feature is accessed by using group.facet=true
>
> Cody
>
> -----Original Message-----
> From: danjfoley [mailto:dan@micamedia.com]
> Sent: Saturday, April 07, 2012 7:02 PM
> To: solr-user@lucene.apache.org
> Subject: Re: To truncate or not to truncate (group.truncate vs. facet)
>
> I've been searching for a solution to my issue, and this seems to come 
> closest to it. But not exactly.
>
> I am indexing clothing. Each article of clothing comes in many sizes 
> and colors, and can belong to any number of categories.
>
> For example take the following: I add 6 documents to solr as follows:
>
> product, color, size, category
>
> shirt A, red, small, valentines day
> shirt A, red, large, valentines day
> shirt A, blue, small, valentines day
> shirt A, blue, large, valentines day
> shirt A, green, small, valentines day
> shirt A, green, large, valentines day
>
> I'd like my facet counts to return as follows:
>
> color
>
> red (1)
> blue (1)
> green (1)
>
> size
>
> small (1)
> large (1)
>
> category
>
> valentines day (1)
>
> But they come back like this:
>
> color:
> red (2)
> blue (2)
> green (2)
>
> size:
> small (2)
> large (2)
>
> category
> valentines day (6)
>
> I see the group.facet parameter in version 4.0 does exactly this. 
> However how can I make this happen now? There are all sorts of 
> ecommerce systems out there that facet exactly how i'm asking. i 
> thought solr is supposed to be the very best fastest search system, 
> yet it doesn't seem to be able to facet correct for items with multiple values?
>
> Am i indexing my data wrong?
>
> how can i make this happen?
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/To-truncate-or-not-to-truncate-grou
> p-truncate-vs-facet-tp3838797p3893744.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>
>
> _______________________________________________
> If you reply to this email, your message will be added to the 
> discussion
> below:
>
> http://lucene.472066.n3.nabble.com/To-truncate-or-not-to-truncate-grou
> p-truncate-vs-facet-tp3838797p3897366.html
>
> To unsubscribe from To truncate or not to truncate (group.truncate vs.
> facet, visit
> http://lucene.472066.n3.nabble.com/template/NamlServlet.jtp?macro=unsu
> bscribe_by_code&node=3838797&code=ZGFuQG1pY2FtZWRpYS5jb218MzgzODc5N3wt
> MTEyNjQzODIyNg==
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/To-truncate-or-not-to-truncate-grou
> p-truncate-vs-facet-tp3838797p3897422.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>
>
> _______________________________________________
> If you reply to this email, your message will be added to the 
> discussion
> below:
>
> http://lucene.472066.n3.nabble.com/To-truncate-or-not-to-truncate-grou
> p-truncate-vs-facet-tp3838797p3897487.html
>
> To unsubscribe from To truncate or not to truncate (group.truncate vs.
> facet, visit
> http://lucene.472066.n3.nabble.com/template/NamlServlet.jtp?macro=unsu
> bscribe_by_c

--
View this message in context: http://lucene.472066.n3.nabble.com/To-truncate-or-not-to-truncate-group-truncate-vs-facet-tp3838797p3898537.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: To truncate or not to truncate (group.truncate vs. facet)

Posted by danjfoley <da...@micamedia.com>.
Is this planned as a future feature? Is it in the bug tracker as a feature yet..just wondering how long until it is a feature.  I could live without price counts for a bit.

Sent from my phone

----- Reply message -----
From: "Martijn v Groningen-2 [via Lucene]" <ml...@n3.nabble.com>
Date: Mon, Apr 9, 2012 3:31 pm
Subject: To truncate or not to truncate (group.truncate vs. facet)
To: "danjfoley" <da...@micamedia.com>



The group.facet option only works for field facets (facet.field). Others
facets types (query, range and pivot) aren't supported yet.
The group.facet works for both single and multivalued fields specified in
the facet.field parameter.

Martijn

On 9 April 2012 20:58, danjfoley <da...@micamedia.com> wrote:

> I am using group.facet and it works fine for regular facet.field but not
> for facet.query
>
> Sent from my phone
>
> ----- Reply message -----
> From: "Young, Cody [via Lucene]" <ml-node+s472066n3897487h46@n3.nabble.com
> >
> Date: Mon, Apr 9, 2012 1:38 pm
> Subject: To truncate or not to truncate (group.truncate vs. facet)
> To: "danjfoley" <da...@micamedia.com>
>
>
>
> One other thing, I believe that you need to be using facet.field on single
> valued string fields for group.facet to function properly. Are the fields
> you're faceting on multiValued=false?
>
> Cody
>
> -----Original Message-----
> From: Young, Cody [mailto:Cody.Young@move.com]
> Sent: Monday, April 09, 2012 10:36 AM
> To: solr-user@lucene.apache.org
> Subject: RE: To truncate or not to truncate (group.truncate vs. facet)
>
> You tried adding the parameter
>
> &group.facet=true ?
>
> Cody
>
> -----Original Message-----
> From: danjfoley [mailto:dan@micamedia.com]
> Sent: Monday, April 09, 2012 10:09 AM
> To: solr-user@lucene.apache.org
> Subject: Re: To truncate or not to truncate (group.truncate vs. facet)
>
> I did get this working with version 4. However my facet queries still
> don't group.
>
> Sent from my phone
>
> ----- Reply message -----
> From: "Young, Cody [via Lucene]" <ml-node+s472066n3897366h95@n3.nabble.com
> >
> Date: Mon, Apr 9, 2012 12:45 pm
> Subject: To truncate or not to truncate (group.truncate vs. facet)
> To: "danjfoley" <da...@micamedia.com>
>
>
>
> I believe you're looking for what's called, "Matrix Counts"
>
> Please see this JIRA issue. To my knowledge it has been committed in trunk
> but not 3.x.
>
> https://issues.apache.org/jira/browse/SOLR-2898
>
> This feature is accessed by using group.facet=true
>
> Cody
>
> -----Original Message-----
> From: danjfoley [mailto:dan@micamedia.com]
> Sent: Saturday, April 07, 2012 7:02 PM
> To: solr-user@lucene.apache.org
> Subject: Re: To truncate or not to truncate (group.truncate vs. facet)
>
> I've been searching for a solution to my issue, and this seems to come
> closest to it. But not exactly.
>
> I am indexing clothing. Each article of clothing comes in many sizes and
> colors, and can belong to any number of categories.
>
> For example take the following: I add 6 documents to solr as follows:
>
> product, color, size, category
>
> shirt A, red, small, valentines day
> shirt A, red, large, valentines day
> shirt A, blue, small, valentines day
> shirt A, blue, large, valentines day
> shirt A, green, small, valentines day
> shirt A, green, large, valentines day
>
> I'd like my facet counts to return as follows:
>
> color
>
> red (1)
> blue (1)
> green (1)
>
> size
>
> small (1)
> large (1)
>
> category
>
> valentines day (1)
>
> But they come back like this:
>
> color:
> red (2)
> blue (2)
> green (2)
>
> size:
> small (2)
> large (2)
>
> category
> valentines day (6)
>
> I see the group.facet parameter in version 4.0 does exactly this. However
> how can I make this happen now? There are all sorts of ecommerce systems
> out there that facet exactly how i'm asking. i thought solr is supposed to
> be the very best fastest search system, yet it doesn't seem to be able to
> facet correct for items with multiple values?
>
> Am i indexing my data wrong?
>
> how can i make this happen?
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/To-truncate-or-not-to-truncate-group-truncate-vs-facet-tp3838797p3893744.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>
>
> _______________________________________________
> If you reply to this email, your message will be added to the discussion
> below:
>
> http://lucene.472066.n3.nabble.com/To-truncate-or-not-to-truncate-group-truncate-vs-facet-tp3838797p3897366.html
>
> To unsubscribe from To truncate or not to truncate (group.truncate vs.
> facet, visit
> http://lucene.472066.n3.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=3838797&code=ZGFuQG1pY2FtZWRpYS5jb218MzgzODc5N3wtMTEyNjQzODIyNg==
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/To-truncate-or-not-to-truncate-group-truncate-vs-facet-tp3838797p3897422.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>
>
> _______________________________________________
> If you reply to this email, your message will be added to the discussion
> below:
>
> http://lucene.472066.n3.nabble.com/To-truncate-or-not-to-truncate-group-truncate-vs-facet-tp3838797p3897487.html
>
> To unsubscribe from To truncate or not to truncate (group.truncate vs.
> facet, visit
> http://lucene.472066.n3.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_c

--
View this message in context: http://lucene.472066.n3.nabble.com/To-truncate-or-not-to-truncate-group-truncate-vs-facet-tp3838797p3898537.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: To truncate or not to truncate (group.truncate vs. facet)

Posted by Martijn v Groningen <ma...@gmail.com>.
The group.facet option only works for field facets (facet.field). Others
facets types (query, range and pivot) aren't supported yet.
The group.facet works for both single and multivalued fields specified in
the facet.field parameter.

Martijn

On 9 April 2012 20:58, danjfoley <da...@micamedia.com> wrote:

> I am using group.facet and it works fine for regular facet.field but not
> for facet.query
>
> Sent from my phone
>
> ----- Reply message -----
> From: "Young, Cody [via Lucene]" <ml-node+s472066n3897487h46@n3.nabble.com
> >
> Date: Mon, Apr 9, 2012 1:38 pm
> Subject: To truncate or not to truncate (group.truncate vs. facet)
> To: "danjfoley" <da...@micamedia.com>
>
>
>
> One other thing, I believe that you need to be using facet.field on single
> valued string fields for group.facet to function properly. Are the fields
> you're faceting on multiValued=false?
>
> Cody
>
> -----Original Message-----
> From: Young, Cody [mailto:Cody.Young@move.com]
> Sent: Monday, April 09, 2012 10:36 AM
> To: solr-user@lucene.apache.org
> Subject: RE: To truncate or not to truncate (group.truncate vs. facet)
>
> You tried adding the parameter
>
> &group.facet=true ?
>
> Cody
>
> -----Original Message-----
> From: danjfoley [mailto:dan@micamedia.com]
> Sent: Monday, April 09, 2012 10:09 AM
> To: solr-user@lucene.apache.org
> Subject: Re: To truncate or not to truncate (group.truncate vs. facet)
>
> I did get this working with version 4. However my facet queries still
> don't group.
>
> Sent from my phone
>
> ----- Reply message -----
> From: "Young, Cody [via Lucene]" <ml-node+s472066n3897366h95@n3.nabble.com
> >
> Date: Mon, Apr 9, 2012 12:45 pm
> Subject: To truncate or not to truncate (group.truncate vs. facet)
> To: "danjfoley" <da...@micamedia.com>
>
>
>
> I believe you're looking for what's called, "Matrix Counts"
>
> Please see this JIRA issue. To my knowledge it has been committed in trunk
> but not 3.x.
>
> https://issues.apache.org/jira/browse/SOLR-2898
>
> This feature is accessed by using group.facet=true
>
> Cody
>
> -----Original Message-----
> From: danjfoley [mailto:dan@micamedia.com]
> Sent: Saturday, April 07, 2012 7:02 PM
> To: solr-user@lucene.apache.org
> Subject: Re: To truncate or not to truncate (group.truncate vs. facet)
>
> I've been searching for a solution to my issue, and this seems to come
> closest to it. But not exactly.
>
> I am indexing clothing. Each article of clothing comes in many sizes and
> colors, and can belong to any number of categories.
>
> For example take the following: I add 6 documents to solr as follows:
>
> product, color, size, category
>
> shirt A, red, small, valentines day
> shirt A, red, large, valentines day
> shirt A, blue, small, valentines day
> shirt A, blue, large, valentines day
> shirt A, green, small, valentines day
> shirt A, green, large, valentines day
>
> I'd like my facet counts to return as follows:
>
> color
>
> red (1)
> blue (1)
> green (1)
>
> size
>
> small (1)
> large (1)
>
> category
>
> valentines day (1)
>
> But they come back like this:
>
> color:
> red (2)
> blue (2)
> green (2)
>
> size:
> small (2)
> large (2)
>
> category
> valentines day (6)
>
> I see the group.facet parameter in version 4.0 does exactly this. However
> how can I make this happen now? There are all sorts of ecommerce systems
> out there that facet exactly how i'm asking. i thought solr is supposed to
> be the very best fastest search system, yet it doesn't seem to be able to
> facet correct for items with multiple values?
>
> Am i indexing my data wrong?
>
> how can i make this happen?
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/To-truncate-or-not-to-truncate-group-truncate-vs-facet-tp3838797p3893744.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>
>
> _______________________________________________
> If you reply to this email, your message will be added to the discussion
> below:
>
> http://lucene.472066.n3.nabble.com/To-truncate-or-not-to-truncate-group-truncate-vs-facet-tp3838797p3897366.html
>
> To unsubscribe from To truncate or not to truncate (group.truncate vs.
> facet, visit
> http://lucene.472066.n3.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=3838797&code=ZGFuQG1pY2FtZWRpYS5jb218MzgzODc5N3wtMTEyNjQzODIyNg==
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/To-truncate-or-not-to-truncate-group-truncate-vs-facet-tp3838797p3897422.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>
>
> _______________________________________________
> If you reply to this email, your message will be added to the discussion
> below:
>
> http://lucene.472066.n3.nabble.com/To-truncate-or-not-to-truncate-group-truncate-vs-facet-tp3838797p3897487.html
>
> To unsubscribe from To truncate or not to truncate (group.truncate vs.
> facet, visit
> http://lucene.472066.n3.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=3838797&code=ZGFuQG1pY2FtZWRpYS5jb218MzgzODc5N3wtMTEyNjQzODIyNg==
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/To-truncate-or-not-to-truncate-group-truncate-vs-facet-tp3838797p3897694.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>



-- 
Met vriendelijke groet,

Martijn van Groningen

Re: To truncate or not to truncate (group.truncate vs. facet)

Posted by danjfoley <da...@micamedia.com>.
I am using group.facet and it works fine for regular facet.field but not for facet.query

Sent from my phone

----- Reply message -----
From: "Young, Cody [via Lucene]" <ml...@n3.nabble.com>
Date: Mon, Apr 9, 2012 1:38 pm
Subject: To truncate or not to truncate (group.truncate vs. facet)
To: "danjfoley" <da...@micamedia.com>



One other thing, I believe that you need to be using facet.field on single valued string fields for group.facet to function properly. Are the fields you're faceting on multiValued=false?

Cody

-----Original Message-----
From: Young, Cody [mailto:Cody.Young@move.com] 
Sent: Monday, April 09, 2012 10:36 AM
To: solr-user@lucene.apache.org
Subject: RE: To truncate or not to truncate (group.truncate vs. facet)

You tried adding the parameter

&group.facet=true ?

Cody

-----Original Message-----
From: danjfoley [mailto:dan@micamedia.com] 
Sent: Monday, April 09, 2012 10:09 AM
To: solr-user@lucene.apache.org
Subject: Re: To truncate or not to truncate (group.truncate vs. facet)

I did get this working with version 4. However my facet queries still don't group.

Sent from my phone

----- Reply message -----
From: "Young, Cody [via Lucene]" <ml...@n3.nabble.com>
Date: Mon, Apr 9, 2012 12:45 pm
Subject: To truncate or not to truncate (group.truncate vs. facet)
To: "danjfoley" <da...@micamedia.com>



I believe you're looking for what's called, "Matrix Counts"

Please see this JIRA issue. To my knowledge it has been committed in trunk but not 3.x.

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

This feature is accessed by using group.facet=true

Cody

-----Original Message-----
From: danjfoley [mailto:dan@micamedia.com] 
Sent: Saturday, April 07, 2012 7:02 PM
To: solr-user@lucene.apache.org
Subject: Re: To truncate or not to truncate (group.truncate vs. facet)

I've been searching for a solution to my issue, and this seems to come closest to it. But not exactly.

I am indexing clothing. Each article of clothing comes in many sizes and colors, and can belong to any number of categories.

For example take the following: I add 6 documents to solr as follows:

product, color, size, category

shirt A, red, small, valentines day
shirt A, red, large, valentines day
shirt A, blue, small, valentines day
shirt A, blue, large, valentines day
shirt A, green, small, valentines day
shirt A, green, large, valentines day

I'd like my facet counts to return as follows:

color

red (1)
blue (1)
green (1)

size

small (1)
large (1)

category

valentines day (1)

But they come back like this:

color:
red (2)
blue (2)
green (2)

size:
small (2)
large (2)

category
valentines day (6)

I see the group.facet parameter in version 4.0 does exactly this. However how can I make this happen now? There are all sorts of ecommerce systems out there that facet exactly how i'm asking. i thought solr is supposed to be the very best fastest search system, yet it doesn't seem to be able to facet correct for items with multiple values?

Am i indexing my data wrong? 

how can i make this happen?

--
View this message in context: http://lucene.472066.n3.nabble.com/To-truncate-or-not-to-truncate-group-truncate-vs-facet-tp3838797p3893744.html
Sent from the Solr - User mailing list archive at Nabble.com.


_______________________________________________
If you reply to this email, your message will be added to the discussion below:
http://lucene.472066.n3.nabble.com/To-truncate-or-not-to-truncate-group-truncate-vs-facet-tp3838797p3897366.html

To unsubscribe from To truncate or not to truncate (group.truncate vs. facet, visit http://lucene.472066.n3.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=3838797&code=ZGFuQG1pY2FtZWRpYS5jb218MzgzODc5N3wtMTEyNjQzODIyNg==

--
View this message in context: http://lucene.472066.n3.nabble.com/To-truncate-or-not-to-truncate-group-truncate-vs-facet-tp3838797p3897422.html
Sent from the Solr - User mailing list archive at Nabble.com.


_______________________________________________
If you reply to this email, your message will be added to the discussion below:
http://lucene.472066.n3.nabble.com/To-truncate-or-not-to-truncate-group-truncate-vs-facet-tp3838797p3897487.html

To unsubscribe from To truncate or not to truncate (group.truncate vs. facet, visit http://lucene.472066.n3.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=3838797&code=ZGFuQG1pY2FtZWRpYS5jb218MzgzODc5N3wtMTEyNjQzODIyNg==

--
View this message in context: http://lucene.472066.n3.nabble.com/To-truncate-or-not-to-truncate-group-truncate-vs-facet-tp3838797p3897694.html
Sent from the Solr - User mailing list archive at Nabble.com.

RE: To truncate or not to truncate (group.truncate vs. facet)

Posted by "Young, Cody" <Co...@move.com>.
One other thing, I believe that you need to be using facet.field on single valued string fields for group.facet to function properly. Are the fields you're faceting on multiValued=false?

Cody

-----Original Message-----
From: Young, Cody [mailto:Cody.Young@move.com] 
Sent: Monday, April 09, 2012 10:36 AM
To: solr-user@lucene.apache.org
Subject: RE: To truncate or not to truncate (group.truncate vs. facet)

You tried adding the parameter

&group.facet=true ?

Cody

-----Original Message-----
From: danjfoley [mailto:dan@micamedia.com] 
Sent: Monday, April 09, 2012 10:09 AM
To: solr-user@lucene.apache.org
Subject: Re: To truncate or not to truncate (group.truncate vs. facet)

I did get this working with version 4. However my facet queries still don't group.

Sent from my phone

----- Reply message -----
From: "Young, Cody [via Lucene]" <ml...@n3.nabble.com>
Date: Mon, Apr 9, 2012 12:45 pm
Subject: To truncate or not to truncate (group.truncate vs. facet)
To: "danjfoley" <da...@micamedia.com>



I believe you're looking for what's called, "Matrix Counts"

Please see this JIRA issue. To my knowledge it has been committed in trunk but not 3.x.

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

This feature is accessed by using group.facet=true

Cody

-----Original Message-----
From: danjfoley [mailto:dan@micamedia.com] 
Sent: Saturday, April 07, 2012 7:02 PM
To: solr-user@lucene.apache.org
Subject: Re: To truncate or not to truncate (group.truncate vs. facet)

I've been searching for a solution to my issue, and this seems to come closest to it. But not exactly.

I am indexing clothing. Each article of clothing comes in many sizes and colors, and can belong to any number of categories.

For example take the following: I add 6 documents to solr as follows:

product, color, size, category

shirt A, red, small, valentines day
shirt A, red, large, valentines day
shirt A, blue, small, valentines day
shirt A, blue, large, valentines day
shirt A, green, small, valentines day
shirt A, green, large, valentines day

I'd like my facet counts to return as follows:

color

red (1)
blue (1)
green (1)

size

small (1)
large (1)

category

valentines day (1)

But they come back like this:

color:
red (2)
blue (2)
green (2)

size:
small (2)
large (2)

category
valentines day (6)

I see the group.facet parameter in version 4.0 does exactly this. However how can I make this happen now? There are all sorts of ecommerce systems out there that facet exactly how i'm asking. i thought solr is supposed to be the very best fastest search system, yet it doesn't seem to be able to facet correct for items with multiple values?

Am i indexing my data wrong? 

how can i make this happen?

--
View this message in context: http://lucene.472066.n3.nabble.com/To-truncate-or-not-to-truncate-group-truncate-vs-facet-tp3838797p3893744.html
Sent from the Solr - User mailing list archive at Nabble.com.


_______________________________________________
If you reply to this email, your message will be added to the discussion below:
http://lucene.472066.n3.nabble.com/To-truncate-or-not-to-truncate-group-truncate-vs-facet-tp3838797p3897366.html

To unsubscribe from To truncate or not to truncate (group.truncate vs. facet, visit http://lucene.472066.n3.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=3838797&code=ZGFuQG1pY2FtZWRpYS5jb218MzgzODc5N3wtMTEyNjQzODIyNg==

--
View this message in context: http://lucene.472066.n3.nabble.com/To-truncate-or-not-to-truncate-group-truncate-vs-facet-tp3838797p3897422.html
Sent from the Solr - User mailing list archive at Nabble.com.

RE: To truncate or not to truncate (group.truncate vs. facet)

Posted by "Young, Cody" <Co...@move.com>.
You tried adding the parameter

&group.facet=true ?

Cody

-----Original Message-----
From: danjfoley [mailto:dan@micamedia.com] 
Sent: Monday, April 09, 2012 10:09 AM
To: solr-user@lucene.apache.org
Subject: Re: To truncate or not to truncate (group.truncate vs. facet)

I did get this working with version 4. However my facet queries still don't group.

Sent from my phone

----- Reply message -----
From: "Young, Cody [via Lucene]" <ml...@n3.nabble.com>
Date: Mon, Apr 9, 2012 12:45 pm
Subject: To truncate or not to truncate (group.truncate vs. facet)
To: "danjfoley" <da...@micamedia.com>



I believe you're looking for what's called, "Matrix Counts"

Please see this JIRA issue. To my knowledge it has been committed in trunk but not 3.x.

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

This feature is accessed by using group.facet=true

Cody

-----Original Message-----
From: danjfoley [mailto:dan@micamedia.com] 
Sent: Saturday, April 07, 2012 7:02 PM
To: solr-user@lucene.apache.org
Subject: Re: To truncate or not to truncate (group.truncate vs. facet)

I've been searching for a solution to my issue, and this seems to come closest to it. But not exactly.

I am indexing clothing. Each article of clothing comes in many sizes and colors, and can belong to any number of categories.

For example take the following: I add 6 documents to solr as follows:

product, color, size, category

shirt A, red, small, valentines day
shirt A, red, large, valentines day
shirt A, blue, small, valentines day
shirt A, blue, large, valentines day
shirt A, green, small, valentines day
shirt A, green, large, valentines day

I'd like my facet counts to return as follows:

color

red (1)
blue (1)
green (1)

size

small (1)
large (1)

category

valentines day (1)

But they come back like this:

color:
red (2)
blue (2)
green (2)

size:
small (2)
large (2)

category
valentines day (6)

I see the group.facet parameter in version 4.0 does exactly this. However how can I make this happen now? There are all sorts of ecommerce systems out there that facet exactly how i'm asking. i thought solr is supposed to be the very best fastest search system, yet it doesn't seem to be able to facet correct for items with multiple values?

Am i indexing my data wrong? 

how can i make this happen?

--
View this message in context: http://lucene.472066.n3.nabble.com/To-truncate-or-not-to-truncate-group-truncate-vs-facet-tp3838797p3893744.html
Sent from the Solr - User mailing list archive at Nabble.com.


_______________________________________________
If you reply to this email, your message will be added to the discussion below:
http://lucene.472066.n3.nabble.com/To-truncate-or-not-to-truncate-group-truncate-vs-facet-tp3838797p3897366.html

To unsubscribe from To truncate or not to truncate (group.truncate vs. facet, visit http://lucene.472066.n3.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=3838797&code=ZGFuQG1pY2FtZWRpYS5jb218MzgzODc5N3wtMTEyNjQzODIyNg==

--
View this message in context: http://lucene.472066.n3.nabble.com/To-truncate-or-not-to-truncate-group-truncate-vs-facet-tp3838797p3897422.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: To truncate or not to truncate (group.truncate vs. facet)

Posted by danjfoley <da...@micamedia.com>.
I did get this working with version 4. However my facet queries still don't group.

Sent from my phone

----- Reply message -----
From: "Young, Cody [via Lucene]" <ml...@n3.nabble.com>
Date: Mon, Apr 9, 2012 12:45 pm
Subject: To truncate or not to truncate (group.truncate vs. facet)
To: "danjfoley" <da...@micamedia.com>



I believe you're looking for what's called, "Matrix Counts"

Please see this JIRA issue. To my knowledge it has been committed in trunk but not 3.x.

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

This feature is accessed by using group.facet=true

Cody

-----Original Message-----
From: danjfoley [mailto:dan@micamedia.com] 
Sent: Saturday, April 07, 2012 7:02 PM
To: solr-user@lucene.apache.org
Subject: Re: To truncate or not to truncate (group.truncate vs. facet)

I've been searching for a solution to my issue, and this seems to come closest to it. But not exactly.

I am indexing clothing. Each article of clothing comes in many sizes and colors, and can belong to any number of categories.

For example take the following: I add 6 documents to solr as follows:

product, color, size, category

shirt A, red, small, valentines day
shirt A, red, large, valentines day
shirt A, blue, small, valentines day
shirt A, blue, large, valentines day
shirt A, green, small, valentines day
shirt A, green, large, valentines day

I'd like my facet counts to return as follows:

color

red (1)
blue (1)
green (1)

size

small (1)
large (1)

category

valentines day (1)

But they come back like this:

color:
red (2)
blue (2)
green (2)

size:
small (2)
large (2)

category
valentines day (6)

I see the group.facet parameter in version 4.0 does exactly this. However how can I make this happen now? There are all sorts of ecommerce systems out there that facet exactly how i'm asking. i thought solr is supposed to be the very best fastest search system, yet it doesn't seem to be able to facet correct for items with multiple values?

Am i indexing my data wrong? 

how can i make this happen?

--
View this message in context: http://lucene.472066.n3.nabble.com/To-truncate-or-not-to-truncate-group-truncate-vs-facet-tp3838797p3893744.html
Sent from the Solr - User mailing list archive at Nabble.com.


_______________________________________________
If you reply to this email, your message will be added to the discussion below:
http://lucene.472066.n3.nabble.com/To-truncate-or-not-to-truncate-group-truncate-vs-facet-tp3838797p3897366.html

To unsubscribe from To truncate or not to truncate (group.truncate vs. facet, visit http://lucene.472066.n3.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=3838797&code=ZGFuQG1pY2FtZWRpYS5jb218MzgzODc5N3wtMTEyNjQzODIyNg==

--
View this message in context: http://lucene.472066.n3.nabble.com/To-truncate-or-not-to-truncate-group-truncate-vs-facet-tp3838797p3897422.html
Sent from the Solr - User mailing list archive at Nabble.com.

RE: To truncate or not to truncate (group.truncate vs. facet)

Posted by "Young, Cody" <Co...@move.com>.
I believe you're looking for what's called, "Matrix Counts"

Please see this JIRA issue. To my knowledge it has been committed in trunk but not 3.x.

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

This feature is accessed by using group.facet=true

Cody

-----Original Message-----
From: danjfoley [mailto:dan@micamedia.com] 
Sent: Saturday, April 07, 2012 7:02 PM
To: solr-user@lucene.apache.org
Subject: Re: To truncate or not to truncate (group.truncate vs. facet)

I've been searching for a solution to my issue, and this seems to come closest to it. But not exactly.

I am indexing clothing. Each article of clothing comes in many sizes and colors, and can belong to any number of categories.

For example take the following: I add 6 documents to solr as follows:

product, color, size, category

shirt A, red, small, valentines day
shirt A, red, large, valentines day
shirt A, blue, small, valentines day
shirt A, blue, large, valentines day
shirt A, green, small, valentines day
shirt A, green, large, valentines day

I'd like my facet counts to return as follows:

color

red (1)
blue (1)
green (1)

size

small (1)
large (1)

category

valentines day (1)

But they come back like this:

color:
red (2)
blue (2)
green (2)

size:
small (2)
large (2)

category
valentines day (6)

I see the group.facet parameter in version 4.0 does exactly this. However how can I make this happen now? There are all sorts of ecommerce systems out there that facet exactly how i'm asking. i thought solr is supposed to be the very best fastest search system, yet it doesn't seem to be able to facet correct for items with multiple values?

Am i indexing my data wrong? 

how can i make this happen?

--
View this message in context: http://lucene.472066.n3.nabble.com/To-truncate-or-not-to-truncate-group-truncate-vs-facet-tp3838797p3893744.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: To truncate or not to truncate (group.truncate vs. facet)

Posted by danjfoley <da...@micamedia.com>.
I've been searching for a solution to my issue, and this seems to come
closest to it. But not exactly.

I am indexing clothing. Each article of clothing comes in many sizes and
colors, and can belong to any number of categories.

For example take the following: I add 6 documents to solr as follows:

product, color, size, category

shirt A, red, small, valentines day
shirt A, red, large, valentines day
shirt A, blue, small, valentines day
shirt A, blue, large, valentines day
shirt A, green, small, valentines day
shirt A, green, large, valentines day

I'd like my facet counts to return as follows:

color

red (1)
blue (1)
green (1)

size

small (1)
large (1)

category

valentines day (1)

But they come back like this:

color:
red (2)
blue (2)
green (2)

size:
small (2)
large (2)

category
valentines day (6)

I see the group.facet parameter in version 4.0 does exactly this. However
how can I make this happen now? There are all sorts of ecommerce systems out
there that facet exactly how i'm asking. i thought solr is supposed to be
the very best fastest search system, yet it doesn't seem to be able to facet
correct for items with multiple values?

Am i indexing my data wrong? 

how can i make this happen?

--
View this message in context: http://lucene.472066.n3.nabble.com/To-truncate-or-not-to-truncate-group-truncate-vs-facet-tp3838797p3893744.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: To truncate or not to truncate (group.truncate vs. facet)

Posted by Erick Erickson <er...@gmail.com>.
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 <ro...@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.

Re: To truncate or not to truncate (group.truncate vs. facet)

Posted by rasser <ro...@vertica.dk>.
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.

Re: To truncate or not to truncate (group.truncate vs. facet)

Posted by Erick Erickson <er...@gmail.com>.
Faceting is orthogonal to grouping, so be careful what you
ask for. So adding faceting would be easy, the only reason
I suggested grouping is your requirement that your brands be
just a count of the number of distinct ones found, not the
number of matching docs.

So a really simple solution would be to forget about grouping
and just facet. Then have your application change the counts
for all the "brand" entries to 1.

Best
Erick

On Mon, Mar 19, 2012 at 5:23 PM, rasser <ro...@vertica.dk> wrote:
> I see your point.
>
> If I understand it correct it will however mean that i need to return
> 10(brands)x100(resultToShow) = 1000 docs to facilitate that all 100 results
> to show is of the same brand. Correnct?
>
> And tomorrow (or later) the customer will also want a facet on 5 new fields
> eg. "production year". How could this be handled with the above approach?
>
> Thanks
>
> --
> View this message in context: http://lucene.472066.n3.nabble.com/To-truncate-or-not-to-truncate-group-truncate-vs-facet-tp3838797p3840406.html
> Sent from the Solr - User mailing list archive at Nabble.com.

Re: To truncate or not to truncate (group.truncate vs. facet)

Posted by rasser <ro...@vertica.dk>.
I see your point.

If I understand it correct it will however mean that i need to return
10(brands)x100(resultToShow) = 1000 docs to facilitate that all 100 results
to show is of the same brand. Correnct?

And tomorrow (or later) the customer will also want a facet on 5 new fields
eg. "production year". How could this be handled with the above approach?

Thanks

--
View this message in context: http://lucene.472066.n3.nabble.com/To-truncate-or-not-to-truncate-group-truncate-vs-facet-tp3838797p3840406.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: To truncate or not to truncate (group.truncate vs. facet)

Posted by Erick Erickson <er...@gmail.com>.
Well, it depends on how many groups we're talking here. Grouping
returns the top N results _within_ each group. So if you have 10
brands and grouped on brand, you'd get back the top, say, 3 results
for Ford, Volvo, Fiat, Saab, Audi.....up to 10 groups.

The number of groups you get back is governed by the "rows"
parameter, and the number of docs in each group
by group.limit

So if you have a reasonable number of brands, this might work

Best
Erick

On Mon, Mar 19, 2012 at 5:01 PM, rasser <ro...@vertica.dk> wrote:
> Thanks for your reply Erick,
>
> As far as I can see grouping on brand  (group.field=brand) will only work if
> all rows are returned. Correct?
>  - if this is so it will not fly since only the top results are returned
> (rows=100)
>
> Or am I missing something.
>
> Thanks
>
> --
> View this message in context: http://lucene.472066.n3.nabble.com/To-truncate-or-not-to-truncate-group-truncate-vs-facet-tp3838797p3840350.html
> Sent from the Solr - User mailing list archive at Nabble.com.

Re: To truncate or not to truncate (group.truncate vs. facet)

Posted by rasser <ro...@vertica.dk>.
Thanks for your reply Erick,

As far as I can see grouping on brand  (group.field=brand) will only work if
all rows are returned. Correct?
 - if this is so it will not fly since only the top results are returned
(rows=100)

Or am I missing something.

Thanks

--
View this message in context: http://lucene.472066.n3.nabble.com/To-truncate-or-not-to-truncate-group-truncate-vs-facet-tp3838797p3840350.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: To truncate or not to truncate (group.truncate vs. facet)

Posted by rasser <ro...@vertica.dk>.
Thanks for the suggestion Martijn.

I did see that v. 4 had a group.facet parameter that seems to fit my needs.

But since I'm new to Solr I'm not really comfortable using version 4 in
production, let alone a nightly build.

Any other ideas? - I cant imagine that i'm the first person ever trying to
combine faceting on both product and variant fields

Thanks



--
View this message in context: http://lucene.472066.n3.nabble.com/To-truncate-or-not-to-truncate-group-truncate-vs-facet-tp3838797p3840362.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: To truncate or not to truncate (group.truncate vs. facet)

Posted by Martijn v Groningen <ma...@gmail.com>.
Hi Rasmus,

You might want to use the group.facet parameter:
http://wiki.apache.org/solr/FieldCollapsing#Request_Parameters

I think that will give you the right facet counts with faceting. The
parameter is not available in Solr 3.x, so you'll need to use a 4.0 nightly
build.

Martijn

On 19 March 2012 13:39, Erick Erickson <er...@gmail.com> wrote:

> Groups and faceting are orthogonal and really have nothing to do with
> each other, so that might be where part of the problem lies.
>
> In your example, you can consider grouping by brand and count the
> *groups* returned, not elements within those groups. Then you're
> simply counting up the groups returned in the response packet. Note
> that this is NOT the stuff down in the "facets" section. You can still
> facet by color just as you are.
>
> Another possibility is to look at "pivot faceting":
> https://issues.apache.org/jira/browse/SOLR-792
> but I confess I haven't explored this so don't really understand if it
> applies to your problem.
>
> Best
> Erick
>
> On Mon, Mar 19, 2012 at 5:22 AM, Rasmus Østergård <ro...@vertica.dk> wrote:
> > I have an index that contains variants of cars. In this small sample I
> have 2 car models (Audi and Volvo) and the Audi is available in black or
> white, whereas the Volvo is only available in black.
> >
> > On the search page I want to display products not variants - in this
> test case 2 products should be shown: "Audi A4" and "Volvo V50"
> >
> > I'm having trouble achieving the desired count in my search facets.
> >
> > This is my test schema:
> >
> > <fields>
> >   <field name=" variant_id" type="string" indexed="true" stored="true"
> required="true" />
> >   <field name="sku" type="string" indexed="true" stored="true" />
> >   <field name="color" type="string" indexed="true" stored="true"/>
> >  </fields>
> > <uniqueKey>variant_id</uniqueKey>
> >
> > Test data:
> >
> > <doc>
> > <field name="sku">Audi A4</field>
> > <field name="brand">audi</field>
> > <!-- Variant properties -->
> > <field name="variant_id">A4_black</field>
> > <field name="color">black</field>
> > </doc>
> > <doc>
> > <field name="sku">Audi A4</field>
> > <field name="brand">audi</field>
> > <!-- Variant properties -->
> > <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>
> > <!-- Variant properties -->
> > <field name="variant_id">Volvo_V50</field>
> > <field name="color">black</field>
> > </doc>
> >
> > My goal is to to get this facet:
> > brand
> > -------------
> > audi (1)
> > volvo (1)
> >
> > color
> > -------------
> > black (2)
> > white (1)
> >
> >
> > I'm trying to use group.truncate to do this but fails.
> >
> > This is my search query when not truncating:
> >
> /select?facet.field=color&facet.field=brand&defType=edixmax&facet=true&group=true&group.field=sku&group.truncate=false
> >
> > brand
> > -------------
> > audi (2)
> > volvo (1)
> >
> > color
> > -------------
> > black (2)
> > white (1)
> >
> >
> > This is my search query when doing truncating:
> >
> /select?facet.field=color&facet.field=brand&defType=edixmax&facet=true&group=true&group.field=sku&group.truncate=true
> >
> > brand
> > -------------
> > audi (1)
> > volvo (1)
> >
> > color
> > -------------
> > black (2)
> > white (0)
> >
> >
> > As can be seen none of the 2 above match my desire.
> > The problem seems to be that I want trucating on only selected facets. I
> this posible?
> >
> > Thanks!
>



-- 
Met vriendelijke groet,

Martijn van Groningen

Re: To truncate or not to truncate (group.truncate vs. facet)

Posted by Erick Erickson <er...@gmail.com>.
Groups and faceting are orthogonal and really have nothing to do with
each other, so that might be where part of the problem lies.

In your example, you can consider grouping by brand and count the
*groups* returned, not elements within those groups. Then you're
simply counting up the groups returned in the response packet. Note
that this is NOT the stuff down in the "facets" section. You can still
facet by color just as you are.

Another possibility is to look at "pivot faceting":
https://issues.apache.org/jira/browse/SOLR-792
but I confess I haven't explored this so don't really understand if it
applies to your problem.

Best
Erick

On Mon, Mar 19, 2012 at 5:22 AM, Rasmus Østergård <ro...@vertica.dk> wrote:
> I have an index that contains variants of cars. In this small sample I have 2 car models (Audi and Volvo) and the Audi is available in black or white, whereas the Volvo is only available in black.
>
> On the search page I want to display products not variants - in this test case 2 products should be shown: "Audi A4" and "Volvo V50"
>
> I'm having trouble achieving the desired count in my search facets.
>
> This is my test schema:
>
> <fields>
>   <field name=" variant_id" type="string" indexed="true" stored="true" required="true" />
>   <field name="sku" type="string" indexed="true" stored="true" />
>   <field name="color" type="string" indexed="true" stored="true"/>
>  </fields>
> <uniqueKey>variant_id</uniqueKey>
>
> Test data:
>
> <doc>
> <field name="sku">Audi A4</field>
> <field name="brand">audi</field>
> <!-- Variant properties -->
> <field name="variant_id">A4_black</field>
> <field name="color">black</field>
> </doc>
> <doc>
> <field name="sku">Audi A4</field>
> <field name="brand">audi</field>
> <!-- Variant properties -->
> <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>
> <!-- Variant properties -->
> <field name="variant_id">Volvo_V50</field>
> <field name="color">black</field>
> </doc>
>
> My goal is to to get this facet:
> brand
> -------------
> audi (1)
> volvo (1)
>
> color
> -------------
> black (2)
> white (1)
>
>
> I'm trying to use group.truncate to do this but fails.
>
> This is my search query when not truncating:
> /select?facet.field=color&facet.field=brand&defType=edixmax&facet=true&group=true&group.field=sku&group.truncate=false
>
> brand
> -------------
> audi (2)
> volvo (1)
>
> color
> -------------
> black (2)
> white (1)
>
>
> This is my search query when doing truncating:
> /select?facet.field=color&facet.field=brand&defType=edixmax&facet=true&group=true&group.field=sku&group.truncate=true
>
> brand
> -------------
> audi (1)
> volvo (1)
>
> color
> -------------
> black (2)
> white (0)
>
>
> As can be seen none of the 2 above match my desire.
> The problem seems to be that I want trucating on only selected facets. I this posible?
>
> Thanks!