You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@solr.apache.org by ishara cooray <is...@gmail.com> on 2021/09/23 06:31:57 UTC

Advance filtering requirement to filter out based on the max value of a field

Hi,

Problem:

I have a solar query to search some documents as below.

name=*&enableStore=(true OR null)&lcState=(PUBLISHED OR PROTOTYPED)

the result of this query returns documents below.

>
> name : API1
> context: /ctx/1.0



>
> name : API1
> context: /ctx/2.0



>
> name: API1
> context: /ctx/3.0



but I want this to return only the document with max context

name: API1
context: /ctx/3.0


Any suggestions how can I improve the above query to achieve this?


Thanks & Regards,

Ishara Cooray
Mobile : +9477 262 9512
WSO2, Inc. | http://wso2.com/
Lean . Enterprise . Middleware
http://cloud.wso2.com/

Re: Advance filtering requirement to filter out based on the max value of a field

Posted by Joel Bernstein <jo...@gmail.com>.
Take a look at:

https://solr.apache.org/guide/8_8/collapse-and-expand-results.html#collapsing-query-parser

The "sort" parameter I believe will work for your use case.

Joel Bernstein
http://joelsolr.blogspot.com/


On Fri, Sep 24, 2021 at 1:55 PM ishara cooray <is...@gmail.com>
wrote:

> Hi,
>
> Problem:
>
> I have a solar query to search some documents as below.
>
> name=*&enableStore=(true OR null)&lcState=(PUBLISHED OR PROTOTYPED)
>
> the result of this query returns documents below.
>
> >
> > name : API1
> > context: /ctx/1.0
>
>
>
> >
> > name : API1
> > context: /ctx/2.0
>
>
>
> >
> > name: API1
> > context: /ctx/3.0
>
>
>
> but I want this to return only the document with max context
>
> name: API1
> context: /ctx/3.0
>
>
> Any suggestions how can I improve the above query to achieve this?
>
>
> Thanks & Regards,
>
> Ishara Cooray
> Mobile : +9477 262 9512
> WSO2, Inc. | http://wso2.com/
> Lean . Enterprise . Middleware
> http://cloud.wso2.com/
>