[ 
https://issues.apache.org/jira/browse/SOLR-11824?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Hoss Man updated SOLR-11824:
----------------------------
    Attachment: SOLR-11824.patch


Here's a patch with beefed up testing to trigger this, and the simplest 
possible fix I know of (borrowing from SOLR-6154): the shards should ignore the 
mincount and allways return every bucket.  This way, regardless of which shard 
replies first, we always know all of the potential buckets (in the correct 
order) and the other shard responses can be merged in trivially.

The other potential approach is to let the shards force a {{mincount=1}} (like 
the existing broken code) and then re-sort the (out of order) buckets -- either 
as they arrive or after all shards have reponded -- but for things like 
CurrencyField SOLR-3218 that's non trivial because the {{"val"}} keys on the 
buckets aren't trivially sortable.  We'd have to complicate the 
{{FacetRangeMerger}} with knowledge of the {{FacetRange.Calc}} ... this seems 
much simpler.

---

Any concerns?

> distributed json.facet "type:range" can return buckets out of order when 
> mincount>0
> -----------------------------------------------------------------------------------
>
>                 Key: SOLR-11824
>                 URL: https://issues.apache.org/jira/browse/SOLR-11824
>             Project: Solr
>          Issue Type: Bug
>      Security Level: Public(Default Security Level. Issues are Public) 
>          Components: Facet Module
>            Reporter: Hoss Man
>         Attachments: SOLR-11824.patch
>
>
> Discovered this while working on SOLR-3218, but it's a general problem with 
> how the code is designed (and the existing code even has a TODO in 
> FacetRangeMerger refering to the problem) ... this is essentially the same 
> bug FacetComponent's {{facet.range}} had that was fixed in SOLR-6154: When he 
> coordinator "combines" the response from each shard, the buckets can get out 
> of order depending on which buckets were excluded by the first shard to 
> respond.
> Depending on how many shards you have, it's fairly trivial to reproduce using 
> {{bin/solr -e cloud}} and the {{exampledocs/*.xml}} files...
> {noformat}
> $ curl http://localhost:8983/solr/techproducts/select -d 
> 'q=*:*&rows=0&wt=xml&json.facet={
> foo:{ type:range, field:price, start:0, end:2000, gap:100, other:all, 
> mincount:1} }'
> <?xml version="1.0" encoding="UTF-8"?>
> <response>
> <lst name="responseHeader">
>   <bool name="zkConnected">true</bool>
>   <int name="status">0</int>
>   <int name="QTime">13</int>
>   <lst name="params">
>     <str name="q">*:*</str>
>     <str name="json.facet">{
> foo:{ type:range, field:price, start:0, end:2000, gap:100, other:all, 
> mincount:1} }</str>
>     <str name="rows">0</str>
>     <str name="wt">xml</str>
>   </lst>
> </lst>
> <result name="response" numFound="32" start="0" maxScore="1.0">
> </result>
> <lst name="facets">
>   <long name="count">32</long>
>   <lst name="foo">
>     <arr name="buckets">
>       <lst>
>         <float name="val">0.0</float>
>         <long name="count">7</long>
>       </lst>
>       <lst>
>         <float name="val">100.0</float>
>         <long name="count">2</long>
>       </lst>
>       <lst>
>         <float name="val">300.0</float>
>         <long name="count">3</long>
>       </lst>
>       <lst>
>         <float name="val">400.0</float>
>         <long name="count">1</long>
>       </lst>
>       <lst>
>         <float name="val">200.0</float>
>         <long name="count">1</long>
>       </lst>
>       <lst>
>         <float name="val">600.0</float>
>         <long name="count">1</long>
>       </lst>
>     </arr>
>     <lst name="before">
>       <long name="count">0</long>
>     </lst>
>     <lst name="after">
>       <long name="count">1</long>
>     </lst>
>     <lst name="between">
>       <long name="count">15</long>
>     </lst>
>   </lst>
> </lst>
> </response>
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

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

Reply via email to