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 <jmluc...@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-unsubscr...@velocity.apache.org For additional commands, e-mail: user-h...@velocity.apache.org