lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erik Hatcher <erik.hatc...@gmail.com>
Subject Re: Minor bug with Solritas and price data
Date Sun, 20 Jun 2010 02:48:09 GMT
That's not a bug with the example schema, as price is a single-valued  
field.  getFirstValue will work, yes, but isn't necessary when it's  
single valued.  If you've got multiple prices, you probably want  
something like:

    #foreach($price in $doc.getFieldValue('price'))$! 
number.currency($price)#end

Note that in your scenario it isn't returning a string with brackets  
(except to the UI) - it's truly an array within the template.

Though maybe what you want in your schema is a single valued price  
field?  :)

	Erik

On Jun 19, 2010, at 9:12 PM, Ken Krugler wrote:

> I noticed that my prices weren't showing up, even though I've got a  
> price field.
>
> I think the issue is with this line from hit.vm:
>
>  <p><b>#field('name')</b> $! 
> number.currency($doc.getFieldValue('price'))</p>
>
> The number.currency() function needs to get passed something that  
> looks like a number, but $doc.getFieldValue() will return "[2.96]",  
> because it could be a list of values.
>
> The square brackets confuse number.currency, so you get no price.
>
> I think this line needs to be:
>
>  <p><b>#field('name')</b> $! 
> number.currency($doc.getFirstValue('price'))</p>
>
> ...since getFirstValue() returns a single value without brackets.
>
> -- Ken
>
> --------------------------------------------
> Ken Krugler
> +1 530-210-6378
> http://bixolabs.com
> e l a s t i c   w e b   m i n i n g
>
>
>
>


Mime
View raw message