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

Hoss Man commented on SOLR-11775:
---------------------------------

{quote}client code should not rely on getting an integer vs a long given that 
distributed search & faceting supports greater than 2B docs.
{quote}

It doesn't feel fair to pass the buck and say "client code should not rely on 
getting what we're giving you" because they have no way of knowing (or reason 
to wonder if) that the data types being returned might change out from under 
them.

If you're a developer just starting out and you're using the XML response, 
you're going to see get back an {{<int>}} and you're going to write code to 
parse that so you can use it.  If you're using solrj, then inspecting the 
Objects in the {{QueryResponse}} during your development is going to show you 
that the "count" is an {{Integer}} and you're going write code that looks 
something like {{Integer count = (Integer) bucket.get("count"))}} in order to 
us that {{Integer}}

that code is going to all work fine in development on single core solr, or even 
when you use your first SolrCloud collection with a single shard -- but as soon 
as you have multiple shards your client code is going to break and it's not 
going to be obvious why.

----

I really think we should just bite the bullet and make all the json.facet 
counts be Longs -- if not on 7.x then at the very least for 8.0, ... and 
*definitely* before anybody spends time working on any SolrJ QueryResponse 
convenience methods/classes for json.facets results.

> json.facet can use inconsistent Long/Integer for "count" depending on shard 
> count
> ---------------------------------------------------------------------------------
>
>                 Key: SOLR-11775
>                 URL: https://issues.apache.org/jira/browse/SOLR-11775
>             Project: Solr
>          Issue Type: Bug
>      Security Level: Public(Default Security Level. Issues are Public) 
>          Components: Facet Module
>            Reporter: Hoss Man
>            Priority: Major
>
> (NOTE: I noticed this while working on a test for {{type: range}} but it's 
> possible other facet types may be affected as well)
> When dealing with a single core request -- either standalone or a collection 
> with only one shard -- json.facet seems to use "Integer" objects to return 
> the "count" of facet buckets, however if the shard count is increased then 
> the end client gets a "Long" object for the "count"
> (This isn't noticable when using {{wt=json}} but can be very problematic when 
> trying to write client code using {{wt=xml}} or SolrJ



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to