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 "unique.jimish@gmail.com" <un...@gmail.com> on 2015/07/28 08:34:42 UTC

Quantity wise price searching in Apache SOLR

Currently I am working on e-commerce website where price can be vary based on
quantity.

For e.g

Product A
    --------------------------------------- 
    Quantity | 25   | 50   | 70   | 90+   |
    ---------------------------------------
    Price    | 0.76 | 0.79 | 0.65 | 0.60 |
    ---------------------------------------

Product B
    ---------------------------------------
    Quantity | 25   | 40   | 65   | 80+   |
    ---------------------------------------
    Price    | 0.81 | 0.73 | 0.62 | 0.60  |
    ---------------------------------------

Please note that quantity break will be different for one and another
product.

How I should save into solr so it fulfill following criteria.

-If user search for desired quantity, system should pick price from that
quantity range. If User search for 60 then system should show 0.65 for
"Product A" and 0.62 for "Product B"
-Also user selects desired quantity and sort by price "lowest to highest" It
should match the price where selected quantity falls. If user search for
quantity 60 then "Product B"(0.62) should be first and "Product A"(0.65)
should be second.
-If user sort "lowest to highest" without selecting quantity then system
show show "Product A" should be first and "Product B" should be second as
Product A (0.76) has lowest price than Product B(0.81)




--
View this message in context: http://lucene.472066.n3.nabble.com/Quantity-wise-price-searching-in-Apache-SOLR-tp4219406.html
Sent from the Solr - User mailing list archive at Nabble.com.

RE: Quantity wise price searching in Apache SOLR

Posted by "Reitzel, Charles" <Ch...@tiaa-cref.org>.
This is a job for a custom query function.

-----Original Message-----
From: unique.jimish@gmail.com [mailto:unique.jimish@gmail.com] 
Sent: Tuesday, July 28, 2015 2:35 AM
To: solr-user@lucene.apache.org
Subject: Quantity wise price searching in Apache SOLR

Currently I am working on e-commerce website where price can be vary based on quantity.

For e.g

Product A
    --------------------------------------- 
    Quantity | 25   | 50   | 70   | 90+   |
    ---------------------------------------
    Price    | 0.76 | 0.79 | 0.65 | 0.60 |
    ---------------------------------------

Product B
    ---------------------------------------
    Quantity | 25   | 40   | 65   | 80+   |
    ---------------------------------------
    Price    | 0.81 | 0.73 | 0.62 | 0.60  |
    ---------------------------------------

Please note that quantity break will be different for one and another product.

How I should save into solr so it fulfill following criteria.

-If user search for desired quantity, system should pick price from that quantity range. If User search for 60 then system should show 0.65 for "Product A" and 0.62 for "Product B"
-Also user selects desired quantity and sort by price "lowest to highest" It should match the price where selected quantity falls. If user search for quantity 60 then "Product B"(0.62) should be first and "Product A"(0.65) should be second.
-If user sort "lowest to highest" without selecting quantity then system show show "Product A" should be first and "Product B" should be second as Product A (0.76) has lowest price than Product B(0.81)




--
View this message in context: http://lucene.472066.n3.nabble.com/Quantity-wise-price-searching-in-Apache-SOLR-tp4219406.html
Sent from the Solr - User mailing list archive at Nabble.com.

*************************************************************************
This e-mail may contain confidential or privileged information.
If you are not the intended recipient, please notify the sender immediately and then delete it.

TIAA-CREF
*************************************************************************


Re: Quantity wise price searching in Apache SOLR

Posted by Alessandro Benedetti <be...@gmail.com>.
As a first sight this is a nested object problem.
Your quantity - price is nested object, child of the Product .

Different approaches can fit with this requirements.
What I would suggest is to give a look so Solr/Lucene Join.

Let's take a quick overview of nested objects in Solr :

1) custom serialization : you can manually serialise the nested objects in
one Solr field. You will need to manage the serialisation at Indexing time
and a proper search at query time. Can be error prone.
This was the only approach pre-join .

2) Query time join - you don't follow any particular indexing strategy -
you pay this with slowest query time performances.
The join will happen query time, you will be able to query on children (
stock with prices) and retrieve parents ( products) and viceversa.
The Join will happen at query time.

3) Index time Join ( Alias Block Join) - it's faster, you need to build
blocks at indexing time ( which means you need to index in a block all the
children and the parent in the end) .
If you need to change a child in the block, you will be to re-index the
whole block.
You have benefit at query time.

Nested objects modelling allow you to search in children and get parents,
the viceversa, calculate nested facets and go to any nesting level.
For sorting, you can not sort on multi valued fields, i.e. duplicating the
price data will not work in the product.
You should proceed sorting on the children.

Take extra care to the scoring model for the Join, in the past only NONE
was supported ( i.e. you filter based on children, you don't score based on
children) .

Cheers


2015-07-28 7:34 GMT+01:00 unique.jimish@gmail.com <un...@gmail.com>:

> Currently I am working on e-commerce website where price can be vary based
> on
> quantity.
>
> For e.g
>
> Product A
>     ---------------------------------------
>     Quantity | 25   | 50   | 70   | 90+   |
>     ---------------------------------------
>     Price    | 0.76 | 0.79 | 0.65 | 0.60 |
>     ---------------------------------------
>
> Product B
>     ---------------------------------------
>     Quantity | 25   | 40   | 65   | 80+   |
>     ---------------------------------------
>     Price    | 0.81 | 0.73 | 0.62 | 0.60  |
>     ---------------------------------------
>
> Please note that quantity break will be different for one and another
> product.
>
> How I should save into solr so it fulfill following criteria.
>
> -If user search for desired quantity, system should pick price from that
> quantity range. If User search for 60 then system should show 0.65 for
> "Product A" and 0.62 for "Product B"
> -Also user selects desired quantity and sort by price "lowest to highest"
> It
> should match the price where selected quantity falls. If user search for
> quantity 60 then "Product B"(0.62) should be first and "Product A"(0.65)
> should be second.
> -If user sort "lowest to highest" without selecting quantity then system
> show show "Product A" should be first and "Product B" should be second as
> Product A (0.76) has lowest price than Product B(0.81)
>
>
>
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/Quantity-wise-price-searching-in-Apache-SOLR-tp4219406.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>



-- 
--------------------------

Benedetti Alessandro
Visiting card - http://about.me/alessandro_benedetti
Blog - http://alexbenedetti.blogspot.co.uk

"Tyger, tyger burning bright
In the forests of the night,
What immortal hand or eye
Could frame thy fearful symmetry?"

William Blake - Songs of Experience -1794 England