Hello,

I suppose there are a clue over there
http://blog.griddynamics.com/2015/08/scoring-join-party-in-solr-53.html

On Wed, Mar 9, 2016 at 6:51 PM, Jhon Smith <doom...@gmx.com> wrote:

> There are usual documents: products and nested documents containing
> different prices.
> How to sort product documents basing on minimum price in nested documents.
>
> Example:
> <doc>
>     <field name="id">1</field>
>     <field name="doc_type">product</field>
>     <doc>
>         <field name="id">2</field>
>         <field name="doc_type">price</field>
>         <field name="price">100</field>
>     </doc>
>     <doc>
>         <field name="id">3</field>
>         <field name="doc_type_s">price</field>
>         <field name="price">200</field>
>     </doc>
> </doc>
> <doc>
>     <field name="id">4</field>
>     <field name="doc_type">product</field>
>     <doc>
>         <field name="id">5</field>
>         <field name="doc_type">price</field>
>         <field name="price">300</field>
>     </doc>
>     <doc>
>         <field name="id">6</field>
>         <field name="doc_type">price</field>
>         <field name="price">50</field>
>     </doc>
> </doc>
>
> So
> product with id=1 has prices 100 and 200: minimum price = 100
> product with id=4 has prices 300 and 50: minimum price = 50
> Hence sorting in ascending order should return second document(id=4) first
> and first document(id=1) next.
>
> Denormalization or storing the min price in product document itself is not
> an option since the actual structure and requirements are more complex.
>
> I guess some function query should be used somehow?
>



-- 
Sincerely yours
Mikhail Khludnev
Principal Engineer,
Grid Dynamics

<http://www.griddynamics.com>
<mkhlud...@griddynamics.com>

Reply via email to