lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Marius Grama (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (SOLR-8768) Wrong behaviour in json facets
Date Fri, 04 Mar 2016 14:52:40 GMT

    [ https://issues.apache.org/jira/browse/SOLR-8768?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15179969#comment-15179969
] 

Marius Grama commented on SOLR-8768:
------------------------------------

[~anzorena.fing@gmail.com] I've tried the sample on master branch that you've provided with
the following query : 

{code}
curl http://localhost:8983/solr/sellers_2016_replica1/select -d 'q=*:*&shards=2014,2015,2016&rows=0&wt=json&
json.facet={
  top_sellers: {
    type: terms,
    field: seller_name,
    limit: 2,
    offset: 0,
    sort: "seller_measure desc",
    facet: {
      seller_measure: "sum(seller_measure)",
      seller_dates: {
        type: range,
        field: seller_date,
        start: "2014-01-01T00:00:00Z",
        end: "2016-12-31T00:00:00Z",
        gap: "%2b1YEAR",
        facet: {
          seller_measure: "sum(seller_measure)"
        }
      }
    }
  }
}'
{code}

and retrieved an accurate result : 

{code}
{  
   "responseHeader":{  
      "zkConnected":true,
      "status":0,
      "QTime":20,
      "params":{  
         "q":"*:*",
         "shards":"2014,2015,2016",
         "json.facet":"{\n  top_sellers: {\n    type: terms,\n    field: seller_name,\n  
 limit: 2,\n    offset: 0,\n    sort: \"seller_measure desc\",\n    facet: {\n      seller_measure:
\"sum(seller_measure)\",\n      seller_dates: {\n        type: range,\n        field: seller_date,\n
       start: \"2014-01-01T00:00:00Z\",\n        end: \"2016-12-31T00:00:00Z\",\n        gap:
\"+1YEAR\",\n        facet: {\n          seller_measure: \"sum(seller_measure)\"\n       
}\n      }\n    }\n  }\n}",
         "rows":"0",
         "wt":"json"
      }
   },
   "response":{  
      "numFound":9,
      "start":0,
      "maxScore":1.0,
      "docs":[  

      ]
   },
   "facets":{  
      "count":9,
      "top_sellers":{  
         "buckets":[  
            {  
               "val":"Jon",
               "count":3,
               "seller_measure":150.0,
               "seller_dates":{  
                  "buckets":[  
                     {  
                        "val":"2014-01-01T00:00:00Z",
                        "count":1,
                        "seller_measure":50.0
                     },
                     {  
                        "val":"2015-01-01T00:00:00Z",
                        "count":1,
                        "seller_measure":50.0
                     },
                     {  
                        "val":"2016-01-01T00:00:00Z",
                        "count":1,
                        "seller_measure":50.0
                     }
                  ]
               }
            },
            {  
               "val":"Tyrion",
               "count":3,
               "seller_measure":102.0,
               "seller_dates":{  
                  "buckets":[  
                     {  
                        "val":"2014-01-01T00:00:00Z",
                        "count":1,
                        "seller_measure":1.0
                     },
                     {  
                        "val":"2015-01-01T00:00:00Z",
                        "count":1,
                        "seller_measure":100.0
                     },
                     {  
                        "val":"2016-01-01T00:00:00Z",
                        "count":1,
                        "seller_measure":1.0
                     }
                  ]
               }
            }
         ]
      }
   }
}
{code}

Also without the date range facet, I got the expected results of :
- Jon 150 
- Tyrion 102

Could you give more details on how you've reproduced the issue?
It makes sense to check whether the documents that you think that are missing exist in the
shards (are you sure that you use only 3 shards in your test?) that you've specified in the
facet query :

{code}
http://localhost:8983/solr/sellers_2015_replica1/select?q=*%3A*&wt=json&indent=true&shards=2014
{code}


> Wrong behaviour in json facets
> ------------------------------
>
>                 Key: SOLR-8768
>                 URL: https://issues.apache.org/jira/browse/SOLR-8768
>             Project: Solr
>          Issue Type: Bug
>          Components: Facet Module
>            Reporter: Pablo Anzorena
>
> This bug is quite difficult to explain it, so I will first show it with an example and
then explain it.
> I have a core splitted into three shards, let's call them 'sellers_2014', 'sellers_2015',
'sellers_2016'.
> The schema has the following fields:
> seller_name, string
> seller_measure, double
> seller_date, date
> With the following data.
> 'sellers_2014'
> Tyrion, 1, 2014-01-01T00:00:00Z
> Jon, 50, 2014-01-01T00:00:00Z
> PoorNed, 4, 2014-01-01T00:00:00Z
> 'sellers_2015'
> Tyrion, 100, 2015-01-01T00:00:00Z
> Jon, 50, 2015-01-01T00:00:00Z
> PoorNed, 4, 2015-01-01T00:00:00Z
> 'sellers_2016'
> Tyrion, 1, 2015-01-01T00:00:00Z
> Jon, 50, 2015-01-01T00:00:00Z
> PoorNed, 4, 2015-01-01T00:00:00Z
> Request:
> http://localhost:8983/solr/sellers_2016/select?q=*:*&shards=localhost:8983/solr/sellers_2014,localhost:8983/solr/sellers_2015,localhost:8983/solr/sellers_2016&json.facet=
> {code}
> {
>   top_sellers: {
>     type: terms,
>     field: seller_name,
>     limit: 2,
>     offset: 0,
>     sort: "seller_measure desc",
>     facet: {
>       seller_measure: "sum(seller_measure)",
>       seller_dates: {
>         type: range,
>         field: seller_date,
>         start: "2014-01-01T00:00:00Z",
>         end: "2016-12-31T00:00:00Z",
>         gap: "+1YEARS",
>         facet: {
>           seller_measure: "sum(seller_measure)"
>         }
>       }
>     }
>   }
> }
> {code}
> So... With the request I want to know the top 2 sellers across the three shards and for
each seller, their seller_measure for each year.
> The response I'm getting is:
> {code}
> "val": "Jon",
> "count": 3,
> "seller_measure": 150,
> "seller_dates": {
>   "buckets": [
>     {
>       "val": "2014-01-01T00:00:00Z",
>       "count": 1,
>       "seller_measure": 50
>     },
>     {
>       "val": "2015-01-01T00:00:00Z",
>       "count": 1,
>       "seller_measure": 50
>     },
>     {
>       "val": "2016-01-01T00:00:00Z",
>       "count": 1,
>       "seller_measure": 50
>     }
>   ]
> },
> "val": "Tyrion",
> "count": 3,
> "seller_measure": 102,
> "seller_dates": {
>   "buckets": [
>     {
>       "val": "2015-01-01T00:00:00Z",
>       "count": 1,
>       "seller_measure": 100
>     }
>   ]
> }
> {code}
> which is incorrect, because the two buckets of 2014 and 2016 in Tyrion are missing.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


Mime
View raw message