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 simon123 <si...@shoe-shop.com> on 2008/10/09 12:21:09 UTC

sub skus with colour and size

Hi

Please forgive my ignorance, i'm a complete newbie with solr and struggling
to find any actual information online.

I'm wanting to build a search for shoes, which from searching the archives I
can see others have been trying to do, but without a clear indication of
how.

I'm attempting to use solrsharp so we can use this with our inhouse .net
applications.

Every product we have comes in colour and size combinations, I need to do a
faceted search on these that allows for colour and size and various other
fields. A single product may have multiple colours and multiple sizes. 

For example a style might be available in black size 12, but also have other
sizes in red. If someone searches for red and size 12, it should not bring
the product as that combination is not possible.

I've see from other threads that people have tried doing a seperate document
for each variation and grouping them together, but have found no examples of
actually making this to work.

I don't even know where to start with this - I've gone through the online
documentation and it doesn't really cover this scenario.

If anyone has any suggestions, i'd be most grateful.


-- 
View this message in context: http://www.nabble.com/sub-skus-with-colour-and-size-tp19896106p19896106.html
Sent from the Solr - User mailing list archive at Nabble.com.


RE: sub skus with colour and size

Posted by Ensdorf Ken <En...@zoominfo.com>.

> Every product we have comes in colour and size combinations,
> I need to do a
> faceted search on these that allows for colour and size and
> various other
> fields. A single product may have multiple colours and multiple sizes.
>
> For example a style might be available in black size 12, but
> also have other
> sizes in red. If someone searches for red and size 12, it
> should not bring
> the product as that combination is not possible.

I'm no expert, but one way to do this would be to have a multi-valued field with all the possible combinations, eg if you have the following in your data:

<color>
        <value>red</value>
        <sizes>10,12</sizes>
</color>
<color>
        <value>black</value>
        <sizes>8,10</sizes>
</color>

you could create a solr doc with a mulitvalued "color" field:

<color>color_red size_10 size_12</color>
<color>color_black size_8 size_10</color>

Then if you set the "positionIncrementGap" in your schema to a sufficiently high value (say 1000), you can use the following query to search for a color size combination:

color:"color_red size_10"~1000

which executes a phrase search with a slop factor of 1000, ensuring it won't cross the field boundary

hope this helps!
-Ken