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 Priti Gupta <pg...@sapient.com> on 2011/09/05 08:43:40 UTC

category tree navigation with the help of solr

Hi,

We are using solr in our ecommerce application.we are indexing on different attributes of products.
We want to create category tree with the help of solr.

There are following points about catgory and products to be considered,
1.One product can belong to more than one categories.
2.category is a hierarchical facet.
3.More than one categories can share same name.

It would be a great help if someone can suggest a way to index and query data based on the above architecture.

Thanks,
Priti

Re: category tree navigation with the help of solr

Posted by Lance Norskog <go...@gmail.com>.
First rule is: denormalize when possible. Just store a separate document
with each combination of attributes: if the Reebok HF comes in red and blue,
store two documents:
Reebok HF,red
Reebok HF,blue

Then, use grouping and facets to decide what to show.

"Category is heierarchical": Pivot facets, facet.pivot=field1,field2,field3
gives a tree-structured list of all documents with shared values of
this&that facet.

"More than one category can share the same name.": In your database you
should have a unique key for every variation of this problem: even if 5 keys
show as "Reebok HF", that is ok. You know internally exactly what these are,
even if they show the same text string.

To search on these strings from clicking on a facet, you need a way to
combine a string to show in the browser with the unique search key. One way
is to add the display string to the key in javascript encoding: the UI
strips off the key and shows the display string, but sends the entire key in
with a search.

On Mon, Sep 5, 2011 at 1:34 AM, Ranveer <ra...@gmail.com> wrote:

> Hi Priti,
>
> You can do this by adding an extra field (string type) for facet on which
> you need to send query.
>
>
> 1.One product can belong to more than one categories.
>
> You can put internal flag for that category at index time, and at the time
> of query you can send that flag to query.
>
> More of less same thing I am doing in www.jagranjosh.com and
> videos.jagran.com
>
> regards
> Ranveer
>
>
>
>
> On Monday 05 Septyember 2011 01:09 PM, Tony Qiu wrote:
>
>> Dear Gupta,
>>
>> In my case, I am doing something similar to you.
>> I use tow core, one core I build category's tree, another core I use to
>> build the product's information include the leaf cat of products. So when
>> one search I get, I will facet the leaf cat, then get the category tree in
>> the category core via product's leafcat (or you can cache the category
>> tree
>> in you memery).
>>
>> Hope this can help u.
>>
>> 2011/9/5 Priti Gupta<pg...@sapient.com>
>>
>>  Hi,
>>>
>>> We are using solr in our ecommerce application.we are indexing on
>>> different
>>> attributes of products.
>>> We want to create category tree with the help of solr.
>>>
>>> There are following points about catgory and products to be considered,
>>> 1.One product can belong to more than one categories.
>>> 2.category is a hierarchical facet.
>>> 3.More than one categories can share same name.
>>>
>>> It would be a great help if someone can suggest a way to index and query
>>> data based on the above architecture.
>>>
>>> Thanks,
>>> Priti
>>>
>>>
>


-- 
Lance Norskog
goksron@gmail.com

Re: category tree navigation with the help of solr

Posted by Ranveer <ra...@gmail.com>.
Hi Priti,

You can do this by adding an extra field (string type) for facet on 
which you need to send query.

1.One product can belong to more than one categories.

You can put internal flag for that category at index time, and at the time of query you can send that flag to query.

More of less same thing I am doing in www.jagranjosh.com and videos.jagran.com

regards
Ranveer



On Monday 05 Septyember 2011 01:09 PM, Tony Qiu wrote:
> Dear Gupta,
>
> In my case, I am doing something similar to you.
> I use tow core, one core I build category's tree, another core I use to
> build the product's information include the leaf cat of products. So when
> one search I get, I will facet the leaf cat, then get the category tree in
> the category core via product's leafcat (or you can cache the category tree
> in you memery).
>
> Hope this can help u.
>
> 2011/9/5 Priti Gupta<pg...@sapient.com>
>
>> Hi,
>>
>> We are using solr in our ecommerce application.we are indexing on different
>> attributes of products.
>> We want to create category tree with the help of solr.
>>
>> There are following points about catgory and products to be considered,
>> 1.One product can belong to more than one categories.
>> 2.category is a hierarchical facet.
>> 3.More than one categories can share same name.
>>
>> It would be a great help if someone can suggest a way to index and query
>> data based on the above architecture.
>>
>> Thanks,
>> Priti
>>


Re: category tree navigation with the help of solr

Posted by Tony Qiu <to...@gmail.com>.
Dear Gupta,

In my case, I am doing something similar to you.
I use tow core, one core I build category's tree, another core I use to
build the product's information include the leaf cat of products. So when
one search I get, I will facet the leaf cat, then get the category tree in
the category core via product's leafcat (or you can cache the category tree
in you memery).

Hope this can help u.

2011/9/5 Priti Gupta <pg...@sapient.com>

> Hi,
>
> We are using solr in our ecommerce application.we are indexing on different
> attributes of products.
> We want to create category tree with the help of solr.
>
> There are following points about catgory and products to be considered,
> 1.One product can belong to more than one categories.
> 2.category is a hierarchical facet.
> 3.More than one categories can share same name.
>
> It would be a great help if someone can suggest a way to index and query
> data based on the above architecture.
>
> Thanks,
> Priti
>

Re: category tree navigation with the help of solr

Posted by Chris Hostetter <ho...@fucit.org>.
: There are following points about catgory and products to be considered,
: 1.One product can belong to more than one categories.
: 2.category is a hierarchical facet.
: 3.More than one categories can share same name.

if multiple categories have the same name (presumably because the hierachy 
is important (ie: "Mens > Shoes; Womens > Shoes; etc...") then usually you 
have some unique id for each category (ie: "1:Mens > 33:Shoes; 2:Womens > 
35:Shoes; etc...) so you just wnat to make sure you index the unique 
category ids.

Depending on what type of navigation you want to support, you  should also 
index all of the "ancestory" category IDs as well.  If all of these IDs 
are indexed in a single multivalued field, it's easy to filter all 
products in category "Mens" or all products in category "Mens > Shoes" 
even if some of those products are also in "Womens > Shoes"

More details about various hierarchical faceting strategies exist on the 
wiki...

https://wiki.apache.org/solr/HierarchicalFaceting




-Hoss