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 danjfoley <da...@micamedia.com> on 2012/04/08 04:03:55 UTC

how to correctly facet clothing multiple sizes and colors?

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/how-to-correctly-facet-clothing-multiple-sizes-and-colors-tp3893747p3893747.html
Sent from the Solr - User mailing list archive at Nabble.com.

RE: how to correctly facet clothing multiple sizes and colors?

Posted by Robert Petersen <ro...@buy.com>.
Well yes but in my experience people generally search for something
particular... then select colors and sizes thereafter.

-----Original Message-----
From: danjfoley [mailto:dan@micamedia.com] 
Sent: Monday, April 09, 2012 4:18 PM
To: solr-user@lucene.apache.org
Subject: Re: how to correctly facet clothing multiple sizes and colors?

The problem with that approach is that if you selected say large and red
you'd get back all the products with large and red as variants. Not the
products with red in the large size add would be expected.

Sent from my phone

----- Reply message -----
From: "Andrew Harvey [via Lucene]"
<ml...@n3.nabble.com>
Date: Mon, Apr 9, 2012 5:21 pm
Subject: how to correctly facet clothing multiple sizes and colors?
To: "danjfoley" <da...@micamedia.com>



What we do in our application is exactly what Robert described. We index
Products, not variants. The variant data (colour, size etc.) is
denormalised into the product document at index time. We then facet on
the variant attributes and get product count instead of variant count. 

What you're seeing are correct results. You are indexing 6 documents, as
you said before. You actually only want to index one document with
multi-valued fields. 

Hope that's somehow helpful,

Andrew

On 10/04/2012, at 3:01, "Robert Petersen" <ro...@buy.com> wrote:

> You *could* do it by making one and only one solr document for each
> clothing item, then just have the front end render all the sizes and
> colors available for that item as size/color pickers on the product
> page.  You can add all the colors and sized to the one document in the
> index so they are searchable also, but the caveat is that they won't
> show up as a facet.  This is just one simple approach.
> 
> -----Original Message-----
> From: danjfoley [mailto:dan@micamedia.com] 
> Sent: Saturday, April 07, 2012 7:04 PM
> To: solr-user@lucene.apache.org
> Subject: how to correctly facet clothing multiple sizes and colors?
> 
> 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/how-to-correctly-facet-clothing-multi
> ple-sizes-and-colors-tp3893747p3893747.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/how-to-correctly-facet-clothing-multi
ple-sizes-and-colors-tp3893747p3898049.html

To unsubscribe from how to correctly facet clothing multiple sizes and
colors?, visit
http://lucene.472066.n3.nabble.com/template/NamlServlet.jtp?macro=unsubs
cribe_by_code&node=3893747&code=ZGFuQG1pY2FtZWRpYS5jb218Mzg5Mzc0N3wtMTEy
NjQzODIyNg==

--
View this message in context:
http://lucene.472066.n3.nabble.com/how-to-correctly-facet-clothing-multi
ple-sizes-and-colors-tp3893747p3898271.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: how to correctly facet clothing multiple sizes and colors?

Posted by danjfoley <da...@micamedia.com>.
The problem with that approach is that if you selected say large and red you'd get back all the products with large and red as variants. Not the products with red in the large size add would be expected.

Sent from my phone

----- Reply message -----
From: "Andrew Harvey [via Lucene]" <ml...@n3.nabble.com>
Date: Mon, Apr 9, 2012 5:21 pm
Subject: how to correctly facet clothing multiple sizes and colors?
To: "danjfoley" <da...@micamedia.com>



What we do in our application is exactly what Robert described. We index Products, not variants. The variant data (colour, size etc.) is denormalised into the product document at index time. We then facet on the variant attributes and get product count instead of variant count. 

What you're seeing are correct results. You are indexing 6 documents, as you said before. You actually only want to index one document with multi-valued fields. 

Hope that's somehow helpful,

Andrew

On 10/04/2012, at 3:01, "Robert Petersen" <ro...@buy.com> wrote:

> You *could* do it by making one and only one solr document for each
> clothing item, then just have the front end render all the sizes and
> colors available for that item as size/color pickers on the product
> page.  You can add all the colors and sized to the one document in the
> index so they are searchable also, but the caveat is that they won't
> show up as a facet.  This is just one simple approach.
> 
> -----Original Message-----
> From: danjfoley [mailto:dan@micamedia.com] 
> Sent: Saturday, April 07, 2012 7:04 PM
> To: solr-user@lucene.apache.org
> Subject: how to correctly facet clothing multiple sizes and colors?
> 
> 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/how-to-correctly-facet-clothing-multi
> ple-sizes-and-colors-tp3893747p3893747.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/how-to-correctly-facet-clothing-multiple-sizes-and-colors-tp3893747p3898049.html

To unsubscribe from how to correctly facet clothing multiple sizes and colors?, visit http://lucene.472066.n3.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=3893747&code=ZGFuQG1pY2FtZWRpYS5jb218Mzg5Mzc0N3wtMTEyNjQzODIyNg==

--
View this message in context: http://lucene.472066.n3.nabble.com/how-to-correctly-facet-clothing-multiple-sizes-and-colors-tp3893747p3898271.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: how to correctly facet clothing multiple sizes and colors?

Posted by Andrew Harvey <an...@mootpointer.com>.
What we do in our application is exactly what Robert described. We index Products, not variants. The variant data (colour, size etc.) is denormalised into the product document at index time. We then facet on the variant attributes and get product count instead of variant count. 

What you're seeing are correct results. You are indexing 6 documents, as you said before. You actually only want to index one document with multi-valued fields. 

Hope that's somehow helpful,

Andrew

On 10/04/2012, at 3:01, "Robert Petersen" <ro...@buy.com> wrote:

> You *could* do it by making one and only one solr document for each
> clothing item, then just have the front end render all the sizes and
> colors available for that item as size/color pickers on the product
> page.  You can add all the colors and sized to the one document in the
> index so they are searchable also, but the caveat is that they won't
> show up as a facet.  This is just one simple approach.
> 
> -----Original Message-----
> From: danjfoley [mailto:dan@micamedia.com] 
> Sent: Saturday, April 07, 2012 7:04 PM
> To: solr-user@lucene.apache.org
> Subject: how to correctly facet clothing multiple sizes and colors?
> 
> 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/how-to-correctly-facet-clothing-multi
> ple-sizes-and-colors-tp3893747p3893747.html
> Sent from the Solr - User mailing list archive at Nabble.com.

RE: how to correctly facet clothing multiple sizes and colors?

Posted by Robert Petersen <ro...@buy.com>.
You *could* do it by making one and only one solr document for each
clothing item, then just have the front end render all the sizes and
colors available for that item as size/color pickers on the product
page.  You can add all the colors and sized to the one document in the
index so they are searchable also, but the caveat is that they won't
show up as a facet.  This is just one simple approach.

-----Original Message-----
From: danjfoley [mailto:dan@micamedia.com] 
Sent: Saturday, April 07, 2012 7:04 PM
To: solr-user@lucene.apache.org
Subject: how to correctly facet clothing multiple sizes and colors?

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/how-to-correctly-facet-clothing-multi
ple-sizes-and-colors-tp3893747p3893747.html
Sent from the Solr - User mailing list archive at Nabble.com.