Just to let you know that there can't have any spaces in the begining of a line code. That leads us to...
#macro(range_get_to_value $inval, $gapval) #if(${gapval.class.name} == "java.lang.String") $inval$gapval## #elseif(${gapval.class.name} == "java.lang.Float" || ${inval.class.name} == "java.lang.Float") #if(${gapval.class.name} == "java.lang.Float") #set($inval2 = $math.toDouble($inval.replace(".",","))) #set($gapval2 = $gapval) #else #set($inval2 = $inval) #set($gapval2 = $math.toDouble($gapval2.replace(".",","))) #end $math.toDouble($math.add($gapval,$inval2))## #else $math.add($inval,$gapval)## #end #end ---- Marcelo Carvalho Fernandes +55 21 8272-7970 +55 21 2205-2786 On Sat, Mar 24, 2012 at 9:12 AM, Marcelo Carvalho Fernandes < mcf2...@gmail.com> wrote: > Hi all! > > I have just solved the problem but I'm not sure if that would be nice to > commit to Solr repository. > How do I go about having this patch approved? > > The changed file is VM_global_library.vm and the changed code is > highlighted as yellow in the following.. > > #macro(range_get_to_value $inval, $gapval) > #if(${gapval.class.name} == "java.lang.String") > $inval$gapval## > #elseif(${gapval.class.name} == "java.lang.Float" || ${inval.class.name} > == "java.lang.Float") > #if(${gapval.class.name} == "java.lang.Float") > #set($inval2 = $math.toDouble($inval.replace(".",","))) > #set($gapval2 = $gapval) > #else > #set($inval2 = $inval) > #set($gapval2 = $math.toDouble($gapval2.replace(".",","))) > #end > $math.toDouble($math.add($gapval,$inval2))## > #else > $math.add($inval,$gapval)## > #end > #end > > Thanks in advance. > > ---- > Marcelo Carvalho Fernandes > +55 21 8272-7970 > +55 21 2205-2786 > > > On Fri, Mar 23, 2012 at 8:13 AM, Marcelo Carvalho Fernandes < > mcf2...@gmail.com> wrote: > >> I went deeper in the problem and discovered that... >> >> $math.toInteger("10.1") returns 101 >> $math.toInteger("10,1") returns 10 >> >> Although I'm using Strings in the previous examples, I have a Float >> variable from Solr. >> >> I'm not sure if it is just a Solr problem, just a Velocity problema or >> somewhere between them. >> >> May it be something related to my local/regional settings or so? I ask >> that because in BRL (Brazilian Real) the currency format we use is >> something line R$1.234,56. >> >> Any idea? >> >> >> >> ---- >> Marcelo Carvalho Fernandes >> +55 21 8272-7970 >> +55 21 2205-2786 >> >> >> On Thu, Mar 22, 2012 at 3:14 PM, Marcelo Carvalho Fernandes < >> mcf2...@gmail.com> wrote: >> >>> Hi all! >>> >>> I'm using Apache Solr 3.5.0 with Tomcat 6.0.32. >>> >>> My schema.xml has a price field declared as... >>> >>> <field name="*preco*" type="*float*" indexed="true" stored="true" >>> required="false" /> >>> >>> My solrconfig.xml has a a velocity RequestHandler (/browser)) that has >>> the following facet... >>> >>> <str name="facet.range">*preco*</str> >>> <int name="f.*preco*.facet.range.start">0</int> >>> <int name="f.*preco*.facet.range.end">100</int> >>> <int name="f.*preco*.facet.range.gap">10</int> >>> >>> ...and I'm using the default templates in >>> <SolrDIR>\example\solr\conf\velocity . >>> >>> The problem is that each peace of range that is being generated has a >>> wrong upper bound. For example, instead of... >>> >>> 0 -10 >>> 10 - 20 >>> 20 - 30 >>> 30 - 40 >>> ... >>> >>> ...what is being generated is... >>> >>> 0 - 10 >>> 10 - 110 >>> 20 - 210 >>> 30 - 310 >>> ... >>> >>> I've studied the #display_facet_range macro in VM_global_library.vm and >>> it looks like the $math.add is contatenating the two operands insted of >>> producing a sum. I mean, insted of 10+10=20 it returns 110, instead of >>> 20+10=30 it returns 210. >>> >>> Any idea what is the problem? >>> >>> Thanks in advance, >>> >>> ---- >>> Marcelo Carvalho Fernandes >>> +55 21 8272-7970 >>> +55 21 2205-2786 >>> >> >> >