velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmlucjav <jmluc...@gmail.com>
Subject Re: issue with vm code not being interpreted
Date Tue, 10 Apr 2012 19:11:51 GMT

Claude,

thanks for the help, and sorry causde i didnt see the reply sooner, didnt
get any email.
While adding debug info u suggested started working again...no i dea how

xab


CloD wrote:
> 
> What is the class of the map keys? If it's Object, then you may run
> into a key class mismatch problem, where, let's say, values are stored
> in the map under Integer keys and then you try to retrieve them using
> Long keys.
> 
> To help debug this, you could try to display some of the following
> expressions:
> 
> map=$response.getExplainMap().keySet().iterator().next().class.name
> 
> doc=$doc.getFirstValue('id').class.name
> 
> contained=$response.getExplainMap().containsKey($doc.getFirstValue('id'))
> 
> Hope this helps,
> 
>   Claude
> 
> On Thu, 22 Mar 2012 01:26:48 -0700 (PDT)
> jmlucjav <jmlucjav@gmail.com> wrote:
> 
>> 
>> Hi,
>> 
>> I am having some issues with part of an expression that is not
>> interpreted. Sorry if this is dumb question but I spent a couple of
>> hours trying to solve this and could not (I am not very experienced
>> in velocity)
>> 
>> This template processes a response from apache solr search server. I
>> have an almost exactly equal template running fine, and I looked at
>> the differences and could not find any.
>> 
>> Code looks like this:
>> 
>> #if($params.getBool("debugQuery",false))
>>    # toggle explain 
>>   <pre
>> style="display:none">$response.getExplainMap().get($doc.getFirstValue('id'))</pre>
>> </pre>
>>    # toggle all fields 
>>   <pre2 style="display:none">
>>   #foreach($fieldname in $doc.fieldNames)
>>      <br>
>>        $fieldname :
>>        
>>        #foreach($value in $doc.getFieldValues($fieldname))
>>          $value  
>>        #end
>>        
>>   #end
>>    </br>
>>   </pre2>
>> #end
>> 
>> The problem is
>> '$response.getExplainMap().get($doc.getFirstValue('id'))' appears as
>> is then the page, is not interpreted. response is the response from
>> solr so has a bunch of info. If I leave only
>> $response.getExplainMap() it works, a map struct is written.
>> $doc.getFirstValue('id') is also interpreted fine (as 1, 2 etc). This
>> exact code is working fine in another Solr project that has same
>> velocity libs etc.
>> 
>> Can anyone think of what is the issue?
>> 
>> thanks
>> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
> For additional commands, e-mail: user-help@velocity.apache.org
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/issue-with-vm-code-not-being-interpreted-tp33544601p33663724.html
Sent from the Velocity - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org


Mime
View raw message