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 2015/05/27 14:29:12 UTC

Dynamic range on numbers

hi all,

i'm attempting to suggest products across a range to users based on
dimensions. if there is a "5x10mm Drill Set" for instance and a competitor
sales something similar enough then i'd like to have it shown. the range,
however, would need to be dynamic. i'm thinking for our initial testing
phase we'll go with 10% in either direction of a number.

thus, a document that hits "drill set" but has the size1 field set to 4.5
or 5.5 would match for the "5" in the query.

1) what's the best field type to use for numeric ranges? i'll need to
account for decimal places, up to two places though usually only one.
2) is there a way to dynamically set the range?

thanks!

Re: Dynamic range on numbers

Posted by Chris Hostetter <ho...@fucit.org>.
: i'm not sure i follow what you're saying on #3. let me clarify in case it's
: on my end. i was wanting to *eventually* set a lower bound of -10%size1 and
: an upper of +10%size1. for the sake of experimentation i started with just

lower bound "of what" ?

write out the math equation you want to satisfy, and you'll see that based 
on your original problem statement there are 3 numbers involved

  X) 0.1
  Y) some fixed numeric value give by your user
  Z) some field value of each document

You said you wnat to find documents where the field value Z is within 
10% (X) of the value Y that your user specified...

	Find all docs such that:
		Z <= Y + Y*X
		Z >= Y - Y*X

At no point in the query/function you were attempting, did you ever 
specify fixed numeric value provided by your user.  What you had written 
was:

	Find all docs such that:
		Z >= Z + Z*X

That's the point i'm making in #3...


: > : 3) right. i hadn't bothered with the upper limit yet simply for sake of
: > : less complexity / chance to fk it up. wanted to get the function working
: > : for lower before worrying about adding u= and getting the query refined
: >
: > To be very clear: even if what you were trying to do worked as you wrote
: > it, adding an upper bound wouldn't change the fact that the comparison you
: > were trying ot make in your query doesn't match the problem statement in
: > your question, and doesn't make sense in general -- you need to compare
: > the field value with 10% of some OTHER input value -- not 10% of itself.
: >
: > Adding an upper bound that was similar to hte lower bound you were trying
: > would have simply prevented any docs from mathcing at all.

	...

: > : > : Expected identifier at pos 29 str='{!frange l=sum(size1,
: > product(size1,
: > : > : .10))}size1

	...

: > : > 3) even if you could pass a function for the "l" param, conceptually
: > what
: > : > you are asking for doesn't really make much sense ... you are asking
: > solr
: > : > to only return documents where the value of the "size1" field is in a
: > : > range between X and infinity, where X is defined as the sum of the
: > value
: > : > of the "size1" field plus 10% of the value of the "size1" field.
: > : >
: > : > In other words: "give me all docs where S * 1.1 <= S"
: > : >
: > : > Basically you are asking it to return all documents with a negative
: > value
: > : > in the "size1" field.


-Hoss
http://www.lucidworks.com/

Re: Dynamic range on numbers

Posted by John Blythe <jo...@curvolabs.com>.
i'm not sure i follow what you're saying on #3. let me clarify in case it's
on my end. i was wanting to *eventually* set a lower bound of -10%size1 and
an upper of +10%size1. for the sake of experimentation i started with just
the lower bound. i didn't care (at that point) about the results, just
getting a successful query to run. upon getting to that point i would then
tailor the lower and upper bounds accordingly to begin testing more true to
life queries.

at any rate, the #4 point seems to be the path to take for the present.

thanks for the discussion!

-- 
*John Blythe*
Product Manager & Lead Developer

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

58 Adams Ave
Evansville, IN 47713

On Thu, May 28, 2015 at 4:56 PM, Chris Hostetter <ho...@fucit.org>
wrote:

>
> : 2) lame :\
>
> Why do you say that? ... it's a practical limitation -- for each document
> a function is computed, and then the result of that function is compared
> against the (fixed) upper and lower bounds.
>
> In situations where you want the something like the lower bound of the
> range comparison to be another function relative to the document, that's
> equivilent to "unwinding" that lower bound function and rolling it into
> the function you are testing -- just like i did in the example i posted in
> "#4" of my email (below)
>
> By requiring that the uper and lower bounds be fixed, the common case can
> be optimized, but cases like that one can stll be supported.  if the lower
> & upper bound params supported arbitrary functions, the implementation
> would be a lot more complex -- slower for hte common case, and hte same
> speed for uncommon cases like what you're describing.
>
> : 3) right. i hadn't bothered with the upper limit yet simply for sake of
> : less complexity / chance to fk it up. wanted to get the function working
> : for lower before worrying about adding u= and getting the query refined
>
> To be very clear: even if what you were trying to do worked as you wrote
> it, adding an upper bound wouldn't change the fact that the comparison you
> were trying ot make in your query doesn't match the problem statement in
> your question, and doesn't make sense in general -- you need to compare
> the field value with 10% of some OTHER input value -- not 10% of itself.
>
> Adding an upper bound that was similar to hte lower bound you were trying
> would have simply prevented any docs from mathcing at all.
>
>
>
> : > : Expected identifier at pos 29 str='{!frange l=sum(size1,
> product(size1,
> : > : .10))}size1
> : > :
> : > : pos 29 is the open parenthesis of product(). can i not use a function
> : > : within a function? or is there something else i'm missing in the way
> i'm
> : > : constructing this?
> : >
> : > 1) you're confusing the parser by trying to put whitespace inside of a
> : > local param (specifically the 'l' param) w/o quoting the param value
> .. it
> : > things that you want "sum(size1" to be the value of the "l" param, and
> : > then it doesn't know what to make of "product(size1" as a another local
> : > param that it can't make sense of.
> : >
> : > 2) if you remove the whitespace, or quote the param, that will solve
> that
> : > parsing error -- but it will lead to a new error from
> : > ValueSourceRangeFilter (ie: "frange") because the "l" param doesn't
> : > support arbitrary functions -- it needs to be a concrete number.
> : >
> : > 3) even if you could pass a function for the "l" param, conceptually
> what
> : > you are asking for doesn't really make much sense ... you are asking
> solr
> : > to only return documents where the value of the "size1" field is in a
> : > range between X and infinity, where X is defined as the sum of the
> value
> : > of the "size1" field plus 10% of the value of the "size1" field.
> : >
> : > In other words: "give me all docs where S * 1.1 <= S"
> : >
> : > Basically you are asking it to return all documents with a negative
> value
> : > in the "size1" field.
> : >
> : >
> : > 4) your original question was about filtering docs where the value of a
> : > field was inside a range of +/- X% of a specified value.  a range query
> : > where you computed the lower/upper bounds bsed on that percentage in
> the
> : > client is really the most straight forward way to do that.
> : >
> : > the main reason to consider using frange for something like this is if
> you
> : > wnat to filter documents based on the reuslts of a function over
> multiple
> : > fields. (ie: "docs where the price field divided by the
> quantity_included
> : > field was within a client specified range")
> : >
> : > adimitedly, you could do something like this...
> : >
> : > fq={!frange u=0.10}div(abs(sub($target,size1)),$target)&target=345
> : >
> : > ...which would tell solr to find you all documents where the "size1"
> field
> : > was within 10% of the target value (345 in this case) -- ie: "310.5 <=
> : > size1 <= 379.5)
> : >
> : > however it's important to realize that doing something like this is
> going
> : > to be less inefficient then just computing the lower/upper range
> : > bounds in the client -- because solr will be evaluating that function
> for
> : > every document in order to make the comparison.  (meanwhile you can
> : > compute the upper and lower bounds exactly once and just let solr do
> the
> : > comparisons)
> : >
> : >
> : > -Hoss
> : > http://www.lucidworks.com/
> : >
> :
>
> -Hoss
> http://www.lucidworks.com/
>

Re: Dynamic range on numbers

Posted by Chris Hostetter <ho...@fucit.org>.
: 2) lame :\

Why do you say that? ... it's a practical limitation -- for each document 
a function is computed, and then the result of that function is compared 
against the (fixed) upper and lower bounds.

In situations where you want the something like the lower bound of the 
range comparison to be another function relative to the document, that's 
equivilent to "unwinding" that lower bound function and rolling it into 
the function you are testing -- just like i did in the example i posted in 
"#4" of my email (below)

By requiring that the uper and lower bounds be fixed, the common case can 
be optimized, but cases like that one can stll be supported.  if the lower 
& upper bound params supported arbitrary functions, the implementation 
would be a lot more complex -- slower for hte common case, and hte same 
speed for uncommon cases like what you're describing.

: 3) right. i hadn't bothered with the upper limit yet simply for sake of
: less complexity / chance to fk it up. wanted to get the function working
: for lower before worrying about adding u= and getting the query refined

To be very clear: even if what you were trying to do worked as you wrote 
it, adding an upper bound wouldn't change the fact that the comparison you 
were trying ot make in your query doesn't match the problem statement in 
your question, and doesn't make sense in general -- you need to compare 
the field value with 10% of some OTHER input value -- not 10% of itself.  

Adding an upper bound that was similar to hte lower bound you were trying 
would have simply prevented any docs from mathcing at all.



: > : Expected identifier at pos 29 str='{!frange l=sum(size1, product(size1,
: > : .10))}size1
: > :
: > : pos 29 is the open parenthesis of product(). can i not use a function
: > : within a function? or is there something else i'm missing in the way i'm
: > : constructing this?
: >
: > 1) you're confusing the parser by trying to put whitespace inside of a
: > local param (specifically the 'l' param) w/o quoting the param value .. it
: > things that you want "sum(size1" to be the value of the "l" param, and
: > then it doesn't know what to make of "product(size1" as a another local
: > param that it can't make sense of.
: >
: > 2) if you remove the whitespace, or quote the param, that will solve that
: > parsing error -- but it will lead to a new error from
: > ValueSourceRangeFilter (ie: "frange") because the "l" param doesn't
: > support arbitrary functions -- it needs to be a concrete number.
: >
: > 3) even if you could pass a function for the "l" param, conceptually what
: > you are asking for doesn't really make much sense ... you are asking solr
: > to only return documents where the value of the "size1" field is in a
: > range between X and infinity, where X is defined as the sum of the value
: > of the "size1" field plus 10% of the value of the "size1" field.
: >
: > In other words: "give me all docs where S * 1.1 <= S"
: >
: > Basically you are asking it to return all documents with a negative value
: > in the "size1" field.
: >
: >
: > 4) your original question was about filtering docs where the value of a
: > field was inside a range of +/- X% of a specified value.  a range query
: > where you computed the lower/upper bounds bsed on that percentage in the
: > client is really the most straight forward way to do that.
: >
: > the main reason to consider using frange for something like this is if you
: > wnat to filter documents based on the reuslts of a function over multiple
: > fields. (ie: "docs where the price field divided by the quantity_included
: > field was within a client specified range")
: >
: > adimitedly, you could do something like this...
: >
: > fq={!frange u=0.10}div(abs(sub($target,size1)),$target)&target=345
: >
: > ...which would tell solr to find you all documents where the "size1" field
: > was within 10% of the target value (345 in this case) -- ie: "310.5 <=
: > size1 <= 379.5)
: >
: > however it's important to realize that doing something like this is going
: > to be less inefficient then just computing the lower/upper range
: > bounds in the client -- because solr will be evaluating that function for
: > every document in order to make the comparison.  (meanwhile you can
: > compute the upper and lower bounds exactly once and just let solr do the
: > comparisons)
: >
: >
: > -Hoss
: > http://www.lucidworks.com/
: >
: 

-Hoss
http://www.lucidworks.com/

Re: Dynamic range on numbers

Posted by John Blythe <jo...@curvolabs.com>.
1) ooo, i see
2) lame :\
3) right. i hadn't bothered with the upper limit yet simply for sake of
less complexity / chance to fk it up. wanted to get the function working
for lower before worrying about adding u= and getting the query refined
4) very good point about just doing it client side. i know in one instance
(and the most immediate one as far as product development/goals is
concerned) this would certainly be both easily doable and desired. there
are other cases where i could see us trying to find a document and then
based off of its returned sizes trying to find a range of items like it
(via morelikethis i assume?).

in either case, point 4 stands and i probably got carried away in the
learning process w/o stepping back to think about real life implementation
and workarounds.

thanks!

-- 
*John Blythe*
Product Manager & Lead Developer

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

58 Adams Ave
Evansville, IN 47713

On Thu, May 28, 2015 at 3:06 PM, Chris Hostetter <ho...@fucit.org>
wrote:

>
> : Expected identifier at pos 29 str='{!frange l=sum(size1, product(size1,
> : .10))}size1
> :
> : pos 29 is the open parenthesis of product(). can i not use a function
> : within a function? or is there something else i'm missing in the way i'm
> : constructing this?
>
> 1) you're confusing the parser by trying to put whitespace inside of a
> local param (specifically the 'l' param) w/o quoting the param value .. it
> things that you want "sum(size1" to be the value of the "l" param, and
> then it doesn't know what to make of "product(size1" as a another local
> param that it can't make sense of.
>
> 2) if you remove the whitespace, or quote the param, that will solve that
> parsing error -- but it will lead to a new error from
> ValueSourceRangeFilter (ie: "frange") because the "l" param doesn't
> support arbitrary functions -- it needs to be a concrete number.
>
> 3) even if you could pass a function for the "l" param, conceptually what
> you are asking for doesn't really make much sense ... you are asking solr
> to only return documents where the value of the "size1" field is in a
> range between X and infinity, where X is defined as the sum of the value
> of the "size1" field plus 10% of the value of the "size1" field.
>
> In other words: "give me all docs where S * 1.1 <= S"
>
> Basically you are asking it to return all documents with a negative value
> in the "size1" field.
>
>
> 4) your original question was about filtering docs where the value of a
> field was inside a range of +/- X% of a specified value.  a range query
> where you computed the lower/upper bounds bsed on that percentage in the
> client is really the most straight forward way to do that.
>
> the main reason to consider using frange for something like this is if you
> wnat to filter documents based on the reuslts of a function over multiple
> fields. (ie: "docs where the price field divided by the quantity_included
> field was within a client specified range")
>
> adimitedly, you could do something like this...
>
> fq={!frange u=0.10}div(abs(sub($target,size1)),$target)&target=345
>
> ...which would tell solr to find you all documents where the "size1" field
> was within 10% of the target value (345 in this case) -- ie: "310.5 <=
> size1 <= 379.5)
>
> however it's important to realize that doing something like this is going
> to be less inefficient then just computing the lower/upper range
> bounds in the client -- because solr will be evaluating that function for
> every document in order to make the comparison.  (meanwhile you can
> compute the upper and lower bounds exactly once and just let solr do the
> comparisons)
>
>
> -Hoss
> http://www.lucidworks.com/
>

Re: Dynamic range on numbers

Posted by Chris Hostetter <ho...@fucit.org>.
: Expected identifier at pos 29 str='{!frange l=sum(size1, product(size1,
: .10))}size1
: 
: pos 29 is the open parenthesis of product(). can i not use a function
: within a function? or is there something else i'm missing in the way i'm
: constructing this?

1) you're confusing the parser by trying to put whitespace inside of a 
local param (specifically the 'l' param) w/o quoting the param value .. it 
things that you want "sum(size1" to be the value of the "l" param, and 
then it doesn't know what to make of "product(size1" as a another local 
param that it can't make sense of.

2) if you remove the whitespace, or quote the param, that will solve that 
parsing error -- but it will lead to a new error from 
ValueSourceRangeFilter (ie: "frange") because the "l" param doesn't 
support arbitrary functions -- it needs to be a concrete number.

3) even if you could pass a function for the "l" param, conceptually what 
you are asking for doesn't really make much sense ... you are asking solr 
to only return documents where the value of the "size1" field is in a 
range between X and infinity, where X is defined as the sum of the value 
of the "size1" field plus 10% of the value of the "size1" field.

In other words: "give me all docs where S * 1.1 <= S"

Basically you are asking it to return all documents with a negative value 
in the "size1" field.


4) your original question was about filtering docs where the value of a 
field was inside a range of +/- X% of a specified value.  a range query 
where you computed the lower/upper bounds bsed on that percentage in the 
client is really the most straight forward way to do that.

the main reason to consider using frange for something like this is if you 
wnat to filter documents based on the reuslts of a function over multiple 
fields. (ie: "docs where the price field divided by the quantity_included 
field was within a client specified range")

adimitedly, you could do something like this...

fq={!frange u=0.10}div(abs(sub($target,size1)),$target)&target=345

...which would tell solr to find you all documents where the "size1" field 
was within 10% of the target value (345 in this case) -- ie: "310.5 <= 
size1 <= 379.5)

however it's important to realize that doing something like this is going 
to be less inefficient then just computing the lower/upper range 
bounds in the client -- because solr will be evaluating that function for 
every document in order to make the comparison.  (meanwhile you can 
compute the upper and lower bounds exactly once and just let solr do the 
comparisons)


-Hoss
http://www.lucidworks.com/

Re: Dynamic range on numbers

Posted by John Blythe <jo...@curvolabs.com>.
doh!

1) silly me, i knew better but was getting tunnel visioned
2) moved to fq and am now getting this error:
Expected identifier at pos 29 str='{!frange l=sum(size1, product(size1,
.10))}size1

pos 29 is the open parenthesis of product(). can i not use a function
within a function? or is there something else i'm missing in the way i'm
constructing this?

thanks for helping me stumble through this!

-- 
*John Blythe*
Product Manager & Lead Developer

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

58 Adams Ave
Evansville, IN 47713

On Thu, May 28, 2015 at 12:37 PM, Erick Erickson <er...@gmail.com>
wrote:

> fq, not fl.
>
> fq is "filter query"
> fl is the "field list", the stored fields to be returned to the user.
>
> Best,
> Erick
>
> On Thu, May 28, 2015 at 9:03 AM, John Blythe <jo...@curvolabs.com> wrote:
> > I've set the field to be processed as such:
> > <fieldType name="sizes" class="solr.TrieDoubleField" precisionStep="6" />
> >
> > and then have this in the fl box in Solr admin UI:
> > *, score, {!frange l=sum(size1, product(size1, .10))}size1
> >
> > I'm trying to use the size1 field as the item upon which a frange is
> being
> > used, but also need to use the size1 value for the mathematical functions
> > themselves
> >
> > I get this error:
> > error": { "msg": "Error parsing fieldname", "code": 400 }
> >
> > thanks for any assistance or insight
> >
> > --
> > *John Blythe*
> > Product Manager & Lead Developer
> >
> > 251.605.3071 | john@curvolabs.com
> > www.curvolabs.com
> >
> > 58 Adams Ave
> > Evansville, IN 47713
> >
> > On Wed, May 27, 2015 at 2:10 PM, John Blythe <jo...@curvolabs.com> wrote:
> >
> >> thanks erick. will give it a whirl later today and report back tonight
> or
> >> tomorrow. i imagine i'll have some more questions crop up :)
> >>
> >> best,
> >>
> >> --
> >> *John Blythe*
> >> Product Manager & Lead Developer
> >>
> >> 251.605.3071 | john@curvolabs.com
> >> www.curvolabs.com
> >>
> >> 58 Adams Ave
> >> Evansville, IN 47713
> >>
> >> On Wed, May 27, 2015 at 1:32 PM, Erick Erickson <
> erickerickson@gmail.com>
> >> wrote:
> >>
> >>> 1> tfloat
> >>> 2> fq=dimField:[4.5 TO 5.5] or even use frange to set the lower and
> >>> upper bounds via function
> >>>
> >>> Best,
> >>> Erick
> >>>
> >>> On Wed, May 27, 2015 at 5:29 AM, John Blythe <jo...@curvolabs.com>
> wrote:
> >>> > hi all,
> >>> >
> >>> > i'm attempting to suggest products across a range to users based on
> >>> > dimensions. if there is a "5x10mm Drill Set" for instance and a
> >>> competitor
> >>> > sales something similar enough then i'd like to have it shown. the
> >>> range,
> >>> > however, would need to be dynamic. i'm thinking for our initial
> testing
> >>> > phase we'll go with 10% in either direction of a number.
> >>> >
> >>> > thus, a document that hits "drill set" but has the size1 field set to
> >>> 4.5
> >>> > or 5.5 would match for the "5" in the query.
> >>> >
> >>> > 1) what's the best field type to use for numeric ranges? i'll need to
> >>> > account for decimal places, up to two places though usually only one.
> >>> > 2) is there a way to dynamically set the range?
> >>> >
> >>> > thanks!
> >>>
> >>
> >>
>

Re: Dynamic range on numbers

Posted by Erick Erickson <er...@gmail.com>.
fq, not fl.

fq is "filter query"
fl is the "field list", the stored fields to be returned to the user.

Best,
Erick

On Thu, May 28, 2015 at 9:03 AM, John Blythe <jo...@curvolabs.com> wrote:
> I've set the field to be processed as such:
> <fieldType name="sizes" class="solr.TrieDoubleField" precisionStep="6" />
>
> and then have this in the fl box in Solr admin UI:
> *, score, {!frange l=sum(size1, product(size1, .10))}size1
>
> I'm trying to use the size1 field as the item upon which a frange is being
> used, but also need to use the size1 value for the mathematical functions
> themselves
>
> I get this error:
> error": { "msg": "Error parsing fieldname", "code": 400 }
>
> thanks for any assistance or insight
>
> --
> *John Blythe*
> Product Manager & Lead Developer
>
> 251.605.3071 | john@curvolabs.com
> www.curvolabs.com
>
> 58 Adams Ave
> Evansville, IN 47713
>
> On Wed, May 27, 2015 at 2:10 PM, John Blythe <jo...@curvolabs.com> wrote:
>
>> thanks erick. will give it a whirl later today and report back tonight or
>> tomorrow. i imagine i'll have some more questions crop up :)
>>
>> best,
>>
>> --
>> *John Blythe*
>> Product Manager & Lead Developer
>>
>> 251.605.3071 | john@curvolabs.com
>> www.curvolabs.com
>>
>> 58 Adams Ave
>> Evansville, IN 47713
>>
>> On Wed, May 27, 2015 at 1:32 PM, Erick Erickson <er...@gmail.com>
>> wrote:
>>
>>> 1> tfloat
>>> 2> fq=dimField:[4.5 TO 5.5] or even use frange to set the lower and
>>> upper bounds via function
>>>
>>> Best,
>>> Erick
>>>
>>> On Wed, May 27, 2015 at 5:29 AM, John Blythe <jo...@curvolabs.com> wrote:
>>> > hi all,
>>> >
>>> > i'm attempting to suggest products across a range to users based on
>>> > dimensions. if there is a "5x10mm Drill Set" for instance and a
>>> competitor
>>> > sales something similar enough then i'd like to have it shown. the
>>> range,
>>> > however, would need to be dynamic. i'm thinking for our initial testing
>>> > phase we'll go with 10% in either direction of a number.
>>> >
>>> > thus, a document that hits "drill set" but has the size1 field set to
>>> 4.5
>>> > or 5.5 would match for the "5" in the query.
>>> >
>>> > 1) what's the best field type to use for numeric ranges? i'll need to
>>> > account for decimal places, up to two places though usually only one.
>>> > 2) is there a way to dynamically set the range?
>>> >
>>> > thanks!
>>>
>>
>>

Re: Dynamic range on numbers

Posted by John Blythe <jo...@curvolabs.com>.
I've set the field to be processed as such:
<fieldType name="sizes" class="solr.TrieDoubleField" precisionStep="6" />

and then have this in the fl box in Solr admin UI:
*, score, {!frange l=sum(size1, product(size1, .10))}size1

I'm trying to use the size1 field as the item upon which a frange is being
used, but also need to use the size1 value for the mathematical functions
themselves

I get this error:
error": { "msg": "Error parsing fieldname", "code": 400 }

thanks for any assistance or insight

-- 
*John Blythe*
Product Manager & Lead Developer

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

58 Adams Ave
Evansville, IN 47713

On Wed, May 27, 2015 at 2:10 PM, John Blythe <jo...@curvolabs.com> wrote:

> thanks erick. will give it a whirl later today and report back tonight or
> tomorrow. i imagine i'll have some more questions crop up :)
>
> best,
>
> --
> *John Blythe*
> Product Manager & Lead Developer
>
> 251.605.3071 | john@curvolabs.com
> www.curvolabs.com
>
> 58 Adams Ave
> Evansville, IN 47713
>
> On Wed, May 27, 2015 at 1:32 PM, Erick Erickson <er...@gmail.com>
> wrote:
>
>> 1> tfloat
>> 2> fq=dimField:[4.5 TO 5.5] or even use frange to set the lower and
>> upper bounds via function
>>
>> Best,
>> Erick
>>
>> On Wed, May 27, 2015 at 5:29 AM, John Blythe <jo...@curvolabs.com> wrote:
>> > hi all,
>> >
>> > i'm attempting to suggest products across a range to users based on
>> > dimensions. if there is a "5x10mm Drill Set" for instance and a
>> competitor
>> > sales something similar enough then i'd like to have it shown. the
>> range,
>> > however, would need to be dynamic. i'm thinking for our initial testing
>> > phase we'll go with 10% in either direction of a number.
>> >
>> > thus, a document that hits "drill set" but has the size1 field set to
>> 4.5
>> > or 5.5 would match for the "5" in the query.
>> >
>> > 1) what's the best field type to use for numeric ranges? i'll need to
>> > account for decimal places, up to two places though usually only one.
>> > 2) is there a way to dynamically set the range?
>> >
>> > thanks!
>>
>
>

Re: Dynamic range on numbers

Posted by John Blythe <jo...@curvolabs.com>.
thanks erick. will give it a whirl later today and report back tonight or
tomorrow. i imagine i'll have some more questions crop up :)

best,

-- 
*John Blythe*
Product Manager & Lead Developer

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

58 Adams Ave
Evansville, IN 47713

On Wed, May 27, 2015 at 1:32 PM, Erick Erickson <er...@gmail.com>
wrote:

> 1> tfloat
> 2> fq=dimField:[4.5 TO 5.5] or even use frange to set the lower and
> upper bounds via function
>
> Best,
> Erick
>
> On Wed, May 27, 2015 at 5:29 AM, John Blythe <jo...@curvolabs.com> wrote:
> > hi all,
> >
> > i'm attempting to suggest products across a range to users based on
> > dimensions. if there is a "5x10mm Drill Set" for instance and a
> competitor
> > sales something similar enough then i'd like to have it shown. the range,
> > however, would need to be dynamic. i'm thinking for our initial testing
> > phase we'll go with 10% in either direction of a number.
> >
> > thus, a document that hits "drill set" but has the size1 field set to 4.5
> > or 5.5 would match for the "5" in the query.
> >
> > 1) what's the best field type to use for numeric ranges? i'll need to
> > account for decimal places, up to two places though usually only one.
> > 2) is there a way to dynamically set the range?
> >
> > thanks!
>

Re: Dynamic range on numbers

Posted by Erick Erickson <er...@gmail.com>.
1> tfloat
2> fq=dimField:[4.5 TO 5.5] or even use frange to set the lower and
upper bounds via function

Best,
Erick

On Wed, May 27, 2015 at 5:29 AM, John Blythe <jo...@curvolabs.com> wrote:
> hi all,
>
> i'm attempting to suggest products across a range to users based on
> dimensions. if there is a "5x10mm Drill Set" for instance and a competitor
> sales something similar enough then i'd like to have it shown. the range,
> however, would need to be dynamic. i'm thinking for our initial testing
> phase we'll go with 10% in either direction of a number.
>
> thus, a document that hits "drill set" but has the size1 field set to 4.5
> or 5.5 would match for the "5" in the query.
>
> 1) what's the best field type to use for numeric ranges? i'll need to
> account for decimal places, up to two places though usually only one.
> 2) is there a way to dynamically set the range?
>
> thanks!