lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yago Riveiro <yago.rive...@gmail.com>
Subject Re: JSON facets, count a long or an integer in cloud and non-cloud modes
Date Tue, 22 Mar 2016 08:52:07 GMT
I have the same problem with a custom response writer.

In production works but in my dev doesn't and are the same version 5.3.1

--
Yago Riveiro

On 22 Mar 2016 08:47 +0000, Markus Jelsma<markus.jelsma@openindex.io>, wrote:
> Hello,
> 
> Using SolrJ i built a method that consumes output produced by JSON facets, it also checks
the count before further processing the output:
> 
> <result name="response" numFound="49" start="0"
> </result
> <lst name="facets"
> <int name="count">49</int
> <lst name="by_day"
> <arr name="buckets"
> <lst
> 
> This is the code reading the count value via SolrJ:
> 
> QueryResponse response = sourceClient.query(query);
> NamedList jsonFacets = (NamedList)response.getResponse().get("facets");
> int totalOccurences = (int)jsonFacets.get("count");
> 
> The problem is, this code doesn't work in unit tests, it throws a:
> java.lang.ClassCastException: java.lang.Long cannot be cast to java.lang.Integer!?
> 
> But why it is an integer right? Anyway, i change the totalOccurences and the cast to
a long and the unit tests runs just fine. But when actually running the code, i suddenly get
another cast exception at exactly the same line.
> java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.Long
> 
> What is going on? The only difference is that the unit tests runs in cloud mode via AbstractFullDistribZkTestBase,
but i run the code in a local dev non-cloud mode. I haven't noticed this behaviour anywhere
else although i have many unit tests consuming lots of different pieces of Solr output, and
all that code runs fine in non-cloud mode too.
> 
> Is this to be expected, normal? Did i catch another bug?
> 
> Thanks!
> Markus

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