lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Venkateswarlu Bommineni <bvr...@gmail.com>
Subject Re: group.limit>1 and sorting is not working as expected
Date Tue, 11 Sep 2018 18:00:04 GMT
Erik and Shawn,

Sorry for the confusion.

Yes Solr is sorting inside the grouped results.but not on all the results.
Example : we have got 6 records by solr response. if i do *sort=price desc
, it is sorting indise each group.*

*But the requirement is to sort on all the results.*

*Current results :*

"matches":14640,
      "groups":[{
          "groupValue":446,
          "doclist":{"numFound":4,"start":0,"docs":[
              {
                "price":32015.0,
                "rank":446},
              {
                "price":32015.0,
                "rank":446},
              {
                "price":*30670.0,*
                "rank":446}]
          }},
        {
          "groupValue":436,
          "doclist":{"numFound":4,"start":0,"docs":[
              {
                "price":*31000.0,*
                "rank":436},
              {
                "price":29040.0,
                "rank":436},
              {
                "price":27775.0,
                "rank":436}]
          }},
        {


What i am expecting is (it might be silly) if i put group.main=true and
sort by price then the results are:

      {
        "priceValueGLP_usd_double":32015.0,
        "sapRank_int":446},
      {
        "priceValueGLP_usd_double":32015.0,
        "sapRank_int":446},
      {
        "priceValueGLP_usd_double":*31000.0*,
        "sapRank_int":445},
      {
        "priceValueGLP_usd_double":*30670.0*,
        "sapRank_int":446},
      {
        "priceValueGLP_usd_double":29040.0,
        "sapRank_int":436},
      {
        "priceValueGLP_usd_double":27775.0,
        "sapRank_int":436},


Sorry if it did not make sense. and suggest if there is any way we can
achieve that.



Thanks,
Venkat.





On Tue, Sep 11, 2018 at 11:37 AM Erick Erickson <erickerickson@gmail.com>
wrote:

> How this all works will be much clearer if you don't use "group.main=true"
>
> But you still haven't _shown_ us what you _expect_.
>
> In the second query, Solr is doing exactly what you're telling it to.
> Return groups of up to three docs lowest-priced docs in each group and
> ordering the groups by the lowest price doc appearing in the group.
>
> What I'm guessing you want to do is specify sort=rank asc&group.sort=price
> asc
>
> Best,
> Erick
> On Tue, Sep 11, 2018 at 10:23 AM Shawn Heisey <apache@elyograg.org> wrote:
> >
> > On 9/11/2018 10:14 AM, Venkateswarlu Bommineni wrote:
> > > Please find the resonse and query when grouping and sorting by rank :
> >
> > I see no evidence of grouping happening in either of those responses.
> > They look like standard responses do when grouping is not enabled.
> >
> > Here's an example of a grouped result from the techproducts example that
> > ships with Solr.  The "response" section is gone and has been replaced
> > by a "grouped" section:
> >
> > |{ "responseHeader":{ "status":0, "QTime":0, "params":{ "q":"*:*",
> > "fl":"id,manu,price", "group.limit":"3", "group.field":"manu",
> > "_":"1536686115965", "group":"true"}}, "grouped":{ "manu":{
> > "matches":32, "groups":[{ "groupValue":null,
> > "doclist":{"numFound":12,"start":0,"docs":[ { "id":"GB18030TEST",
> > "price":0.0}, { "id":"adata"}, { "id":"apple"}] }}, {
> > "groupValue":"Samsung Electronics Co. Ltd.",
> > "doclist":{"numFound":1,"start":0,"docs":[ { "id":"SP2514N",
> > "manu":"Samsung Electronics Co. Ltd.", "price":92.0}] }}, {
> > "groupValue":"Maxtor Corp.", "doclist":{"numFound":1,"start":0,"docs":[
> > { "id":"6H500F0", "manu":"Maxtor Corp.", "price":350.0}] }}, {
> > "groupValue":"Belkin", "doclist":{"numFound":2,"start":0,"docs":[ {
> > "id":"F8V7067-APL-KIT", "manu":"Belkin", "price":19.95}, { "id":"IW-02",
> > "manu":"Belkin", "price":11.5}] }}, { "groupValue":"Apple Computer
> > Inc.", "doclist":{"numFound":1,"start":0,"docs":[ { "id":"MA147LL/A",
> > "manu":"Apple Computer Inc.", "price":399.0}] }}, {
> > "groupValue":"Corsair Microsystems Inc.",
> > "doclist":{"numFound":2,"start":0,"docs":[ { "id":"TWINX2048-3200PRO",
> > "manu":"Corsair Microsystems Inc.", "price":185.0}, { "id":"VS1GB400C3",
> > "manu":"Corsair Microsystems Inc.", "price":74.99}] }}, {
> > "groupValue":"A-DATA Technology Inc.",
> > "doclist":{"numFound":1,"start":0,"docs":[ { "id":"VDBDB1A16",
> > "manu":"A-DATA Technology Inc."}] }}, { "groupValue":"Bank of America",
> > "doclist":{"numFound":1,"start":0,"docs":[ { "id":"USD", "manu":"Bank of
> > America"}] }}, { "groupValue":"European Union",
> > "doclist":{"numFound":1,"start":0,"docs":[ { "id":"EUR",
> > "manu":"European Union"}] }}, { "groupValue":"U.K.",
> > "doclist":{"numFound":1,"start":0,"docs":[ { "id":"GBP", "manu":"U.K."}]
> > }}]}}} ||Thanks,||Shawn|
> >
> > ||||
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message