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 <ishara.coo...@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/ >