On the surface, you could simply add some more fields to your schema.  But as 
far as I can tell, you would have to have a separate Solr "document" for each 
SKU/size combination,  and store the rest of the information (brand, model, 
color, SKU) redundantly and make the unique key a combination of the SKU and 
the size (presumably by having an additional field called sku_size - as far as 
I can tell Solr can't make a key up out of multiple fields).

But, perhaps you shouldn't store that dynamic inventory information in Solr.   
Instead store a key that gets you to an inventory database organized by SKU and 
size.  In such a schema, Size could be added as a multi-valued field to your 
existing schema, so you would know what sizes existed, so you could at least 
facet on that, maybe.  That way Solr doesn't have to be updated every time the 
inventory changes.  Of course, that won't help with the faceting  on variant 
inventory.
 
-----Original Message-----
From: Steve Cerny [mailto:sjce...@gmail.com] 
Sent: Monday, August 15, 2011 6:29 PM
To: solr-user@lucene.apache.org
Subject: Product data schema question

I'm working on an online eCommerce project and am having difficulties
building the core / index schema.  Here is the way we organize our product
information in a normalized database.

A product model has many SKUs (called colorways)
A SKU has many sizes (called variants)
A SKU size has associated inventory (called variant inventory)

When we setup our product core we have the following field information

Doc
* brand
* model name
* SKU
* color name

Sample records are as follows

* Haynes, Undershirt, 1234, white
* Haynes, Undershirt, 1235, grey
* Fruit of the Loom, Undershirt, 1236, white
* Fruit of the Loom, Underwear, 1237, grey

The issue I'm having is I want to add inventory to each size of each SKU for
faceting.  Example,

SKU 1234 has sizes small, medium, large.  Size small has 5 in stock, size
medium 10, and size large 25.

In a normalized data table I would have a separate table just for inventory
and related it back to the SKU with a foreign key.  How do I store size and
inventory information effectively with Solr?

-- 
Steve

Reply via email to