Ah of course, it worked before i enabled docValues for that field.

Got it working again!
Thanks!
 
-----Original message-----
> From:Emir Arnautović <emir.arnauto...@sematext.com>
> Sent: Wednesday 20th December 2017 16:02
> To: solr-user@lucene.apache.org
> Subject: Re: DocTransformer: Float cannot be cast to 
> org.apache.lucene.document.StoredField
> 
> I did not check the code, but that is what error is suggesting. Can you check 
> if field definition is the same locally and on other Solr. Since Solr can use 
> doc values as stored, I would guess that it is not always StoredField that is 
> returned.
> 
> Regards,
> Emir
> --
> Monitoring - Log Management - Alerting - Anomaly Detection
> Solr & Elasticsearch Consulting Support Training - http://sematext.com/
> 
> 
> 
> > On 20 Dec 2017, at 15:52, Markus Jelsma <markus.jel...@openindex.io> wrote:
> > 
> > Are you telling my that SolrDocument.get(key) can return both StoredField 
> > or the actual class of the value?
> > 
> > The code ran fine locally. There i got a StoredField and had to use 
> > numericValue() to get my float.
> > 
> > Thanks,
> > Markus
> > 
> > 
> > 
> > -----Original message-----
> >> From:Emir Arnautović <emir.arnauto...@sematext.com>
> >> Sent: Wednesday 20th December 2017 14:49
> >> To: solr-user@lucene.apache.org
> >> Subject: Re: DocTransformer: Float cannot be cast to 
> >> org.apache.lucene.document.StoredField
> >> 
> >> Hi Markus,
> >> You are trying to cast to stored field without checking if that is 
> >> actually StoredField. What you can do is check first if StoredField or 
> >> Float or… and cast to appropriate value.
> >> 
> >> HTH,
> >> Emir
> >> --
> >> Monitoring - Log Management - Alerting - Anomaly Detection
> >> Solr & Elasticsearch Consulting Support Training - http://sematext.com/
> >> 
> >> 
> >> 
> >>> On 20 Dec 2017, at 14:09, Markus Jelsma <markus.jel...@openindex.io> 
> >>> wrote:
> >>> 
> >>> Hello,
> >>> 
> >>> Recently i had to make yet another DocTransformer. It ran fine on my 
> >>> local machine, this is what i get in production, on freshly reindexed 
> >>> data.
> >>> 
> >>> 2017-12-20 12:12:58.987 ERROR (qtp329611835-17) [c:documents s:shard2 
> >>> r:core_node1 x:documents_shard2_replica2] o.a.s.s.HttpSolrCall 
> >>> null:java.lang.ClassCastException: java.lang.Float cannot be cast to 
> >>> org.apache.lucene.document.StoredField
> >>>       at 
> >>> io.openindex.lunar.response.transform.ScoreNormalizingTransformer.transform(ScoreNormalizingTransformer.java:80)
> >>>       at org.apache.solr.response.DocsStreamer.next(DocsStreamer.java:120)
> >>>       at org.apache.solr.response.DocsStreamer.next(DocsStreamer.java:57)
> >>>       at 
> >>> org.apache.solr.response.BinaryResponseWriter$Resolver.writeResultsBody(BinaryResponseWriter.java:126)
> >>>       at 
> >>> org.apache.solr.response.BinaryResponseWriter$Resolver.writeResults(BinaryResponseWriter.java:145)
> >>>       at 
> >>> org.apache.solr.response.BinaryResponseWriter$Resolver.resolve(BinaryResponseWriter.java:89)
> >>> 
> >>> It trips over this line. I need to get the float from the document.
> >>>    StoredField value = (StoredField)doc.get(field);
> >>> 
> >>> I have had this before sometimes with another DocTransformer, i never 
> >>> solved the problem it went away instead.
> >>> 
> >>> Any ideas?
> >>> 
> >>> Many many thanks,
> >>> Markus
> >> 
> >> 
> 
> 

Reply via email to