You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by John Blythe <jo...@curvolabs.com> on 2016/06/24 13:13:07 UTC

frange and calculated values

hi all,

i'm querying a pricing benchmark data set with product level detail from a
customer's recent purchases. to help refine things, i'm attempting to keep
the low benchmark price within a 3x and 1/3x range of the currently paid
price.

so, for instance, if i've been buying Foo at $100, I don't want any results
less than $33 or more than $300 in the 'benchmarkLow' field

i'm tripping over syntax, i think. i currently have:

{!frange l=div(100,3) u=prod(100,3) v='benchmarkLow'}

i've also tried it with the benchmarkLow outside the curly:
{!frange}benchmarkLow

the benchmark field is a double, fwiw.

what am i missing here?

thanks for any info!

Re: frange and calculated values

Posted by John Blythe <jo...@curvolabs.com>.
ahh, bummer!

yup, will do the work before producing the query.

thanks, erik!

-- 
*John Blythe*
Product Manager & Lead Developer

251.605.3071 | john@curvolabs.com
www.curvolabs.com

58 Adams Ave
Evansville, IN 47713

On Fri, Jun 24, 2016 at 11:39 AM, Erik Hatcher <er...@gmail.com>
wrote:

> John -
>
> I’m pretty sure that l(ower) and u(pper) values must be actual float
> numbers, not functions.   I’ve just traced through the code and I don’t see
> that it interprets anything before converting the string value to a float
> in FunctionValues#getRangeScorer.   Just do the math and hard-code those
> numbers in.    You could indirect them though and have l=$lower, u=$upper
> and &lower=33.3 and $upper=300.0
>
>         Erik
>
>
>
> > On Jun 24, 2016, at 9:13 AM, John Blythe <jo...@curvolabs.com> wrote:
> >
> > hi all,
> >
> > i'm querying a pricing benchmark data set with product level detail from
> a
> > customer's recent purchases. to help refine things, i'm attempting to
> keep
> > the low benchmark price within a 3x and 1/3x range of the currently paid
> > price.
> >
> > so, for instance, if i've been buying Foo at $100, I don't want any
> results
> > less than $33 or more than $300 in the 'benchmarkLow' field
> >
> > i'm tripping over syntax, i think. i currently have:
> >
> > {!frange l=div(100,3) u=prod(100,3) v='benchmarkLow'}
> >
> > i've also tried it with the benchmarkLow outside the curly:
> > {!frange}benchmarkLow
> >
> > the benchmark field is a double, fwiw.
> >
> > what am i missing here?
> >
> > thanks for any info!
>
>

Re: frange and calculated values

Posted by Erik Hatcher <er...@gmail.com>.
John -

I’m pretty sure that l(ower) and u(pper) values must be actual float numbers, not functions.   I’ve just traced through the code and I don’t see that it interprets anything before converting the string value to a float in FunctionValues#getRangeScorer.   Just do the math and hard-code those numbers in.    You could indirect them though and have l=$lower, u=$upper and &lower=33.3 and $upper=300.0

	Erik



> On Jun 24, 2016, at 9:13 AM, John Blythe <jo...@curvolabs.com> wrote:
> 
> hi all,
> 
> i'm querying a pricing benchmark data set with product level detail from a
> customer's recent purchases. to help refine things, i'm attempting to keep
> the low benchmark price within a 3x and 1/3x range of the currently paid
> price.
> 
> so, for instance, if i've been buying Foo at $100, I don't want any results
> less than $33 or more than $300 in the 'benchmarkLow' field
> 
> i'm tripping over syntax, i think. i currently have:
> 
> {!frange l=div(100,3) u=prod(100,3) v='benchmarkLow'}
> 
> i've also tried it with the benchmarkLow outside the curly:
> {!frange}benchmarkLow
> 
> the benchmark field is a double, fwiw.
> 
> what am i missing here?
> 
> thanks for any info!