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 Mark <st...@gmail.com> on 2013/07/25 18:42:00 UTC

Duplicate documents based on attribute

How would I go about doing something like this. Not sure if this is something that can be accomplished on the index side or its something that should be done in our application. 

Say we are an online store for shoes and we are selling Product A in red, blue and green. Is there a way when we search for Product A all three results can be returned even though they are logically the same item (same product in our database).

Thoughts on how this can be accomplished?

Thanks

- M

Re: Duplicate documents based on attribute

Posted by Aditya <fi...@gmail.com>.
You need to store the color field as multi valued stored field. You have to
do pagination manually. If you worried, then use database. Have a table
with Product Name and Color. You could retrieve data with pagination.

Still if you want to achieve it via Solr. Have a separate record for every
product and color. ProductName, Color, RecordType. Since Solr is NoSQL, you
could have different fields and not all records should have all the fields.
You could store different type of document. Filter the record by its type.

Regards
Aditya
www.findbestopensource.com






On Thu, Jul 25, 2013 at 11:01 PM, Alexandre Rafalovitch
<ar...@gmail.com>wrote:

> Look for the presentations online. You are not the first store to use Solr,
> there are some explanations around. Try one from Gilt, but I think there
> were more.
>
> You will want to store data at the lowest meaningful level of search
> granularity. So, in your case, it might be ProductVariation (shoes+color).
> Some examples I have seen, even store it down to availability level or
> price-difference level. Then, you do some post-search normalization either
> by doing groups or by doing filtering.
>
> Solr is not a database, store what you want to find.
>
> Regards,
>    Alex.
>
> Personal website: http://www.outerthoughts.com/
> LinkedIn: http://www.linkedin.com/in/alexandrerafalovitch
> - Time is the quality of nature that keeps events from happening all at
> once. Lately, it doesn't seem to be working.  (Anonymous  - via GTD book)
>
>
> On Thu, Jul 25, 2013 at 12:42 PM, Mark <st...@gmail.com> wrote:
>
> > How would I go about doing something like this. Not sure if this is
> > something that can be accomplished on the index side or its something
> that
> > should be done in our application.
> >
> > Say we are an online store for shoes and we are selling Product A in red,
> > blue and green. Is there a way when we search for Product A all three
> > results can be returned even though they are logically the same item
> (same
> > product in our database).
> >
> > Thoughts on how this can be accomplished?
> >
> > Thanks
> >
> > - M
>

Re: Duplicate documents based on attribute

Posted by Alexandre Rafalovitch <ar...@gmail.com>.
Look for the presentations online. You are not the first store to use Solr,
there are some explanations around. Try one from Gilt, but I think there
were more.

You will want to store data at the lowest meaningful level of search
granularity. So, in your case, it might be ProductVariation (shoes+color).
Some examples I have seen, even store it down to availability level or
price-difference level. Then, you do some post-search normalization either
by doing groups or by doing filtering.

Solr is not a database, store what you want to find.

Regards,
   Alex.

Personal website: http://www.outerthoughts.com/
LinkedIn: http://www.linkedin.com/in/alexandrerafalovitch
- Time is the quality of nature that keeps events from happening all at
once. Lately, it doesn't seem to be working.  (Anonymous  - via GTD book)


On Thu, Jul 25, 2013 at 12:42 PM, Mark <st...@gmail.com> wrote:

> How would I go about doing something like this. Not sure if this is
> something that can be accomplished on the index side or its something that
> should be done in our application.
>
> Say we are an online store for shoes and we are selling Product A in red,
> blue and green. Is there a way when we search for Product A all three
> results can be returned even though they are logically the same item (same
> product in our database).
>
> Thoughts on how this can be accomplished?
>
> Thanks
>
> - M

Re: Duplicate documents based on attribute

Posted by Mark <st...@gmail.com>.
I was hoping to do this from within Solr, that way I don't have to manually mess around with pagination.  The number of items on each page would be indeterministic. 
On Jul 25, 2013, at 9:48 AM, Anshum Gupta <an...@anshumgupta.net> wrote:

> Have a multivalued stored 'color' field and just iterate on it outside of
> solr.
> 
> 
> On Thu, Jul 25, 2013 at 10:12 PM, Mark <st...@gmail.com> wrote:
> 
>> How would I go about doing something like this. Not sure if this is
>> something that can be accomplished on the index side or its something that
>> should be done in our application.
>> 
>> Say we are an online store for shoes and we are selling Product A in red,
>> blue and green. Is there a way when we search for Product A all three
>> results can be returned even though they are logically the same item (same
>> product in our database).
>> 
>> Thoughts on how this can be accomplished?
>> 
>> Thanks
>> 
>> - M
> 
> 
> 
> 
> -- 
> 
> Anshum Gupta
> http://www.anshumgupta.net


Re: Duplicate documents based on attribute

Posted by Anshum Gupta <an...@anshumgupta.net>.
Have a multivalued stored 'color' field and just iterate on it outside of
solr.


On Thu, Jul 25, 2013 at 10:12 PM, Mark <st...@gmail.com> wrote:

> How would I go about doing something like this. Not sure if this is
> something that can be accomplished on the index side or its something that
> should be done in our application.
>
> Say we are an online store for shoes and we are selling Product A in red,
> blue and green. Is there a way when we search for Product A all three
> results can be returned even though they are logically the same item (same
> product in our database).
>
> Thoughts on how this can be accomplished?
>
> Thanks
>
> - M




-- 

Anshum Gupta
http://www.anshumgupta.net