It's also can be done with {!join .. score=max}... but this join is usually
slow on big indices.

On Mon, Jan 15, 2018 at 7:27 PM, Max Bridgewater <max.bridgewa...@gmail.com>
wrote:

> Hi,
>
> My index is composed of product reviews. Each review contains the id of the
> product it refers to. But it also contains a rating for this product and
> the number of negative feedback provided on this product.
>
> {
>    id: solr doc id,
>    rating: number between 0 and 5,
>    product_id: the product that is being reviewed,
>    negative_feedback: how many negative feedbacks on this product
> }
>
> The query below returns the "worst" review for the given product  7453632.
> Worst is defined as  rated 1 to 3 and having the highest number of negative
> feedback.
>
> /select?q=product_id:7453632&fq=rating:[1 TO 3]&sort=negative_feedback
> desc&rows=1
>
> The query works as intended. Now the challenging part is to extend this
> query to support many product_id. If executed with many product Id, the
> result should be the list of worst reviews for all the provided products.
>
> A query of the following form would return the list of worst products for
> products: 7453632,645454,534664.
>
> /select?q=product_id:[7453632,645454,534664]&fq=rating:[1 TO
> 3]&sort=negative_feedback desc
>
> Is there a way to do this in Solr without custom component?
>
> Thanks.
> Max
>



-- 
Sincerely yours
Mikhail Khludnev

Reply via email to