Hi Chris

Thanks for the clarification.

My Doubt:* You said:
so if the range of legal values is 0-100, and you care about 10-20

sort=map(map(myNumField,0,10,0),20,100,0) desc, score desc
sort=map(map(myNumField,0,10,100),20,100,100) asc, score desc
*
By doing the first one, I got results with "myNumField" values between 10
and 20 ranked above all, in the descending order - 20, 18, 17, 13 etc.

By doing the second one, I expected to get the same results, ordered like
13, 17,18, 20. But, what I got were other values as results, that are not in
the chosen range: 9, 8,7, 5 etc.

My question previously was: How to get results with "myNumFields" values
between 10 and 20 ranked above the rest, in the ascending order.

Regards
Sowmya.
On Tue, Aug 23, 2011 at 7:48 PM, Chris Hostetter
<hossman_luc...@fucit.org>wrote:

>
> : I did not quite understand how that function was made. But, it does work
>
> basically the "map" function just translates values in a ranage to some
> fixed vald value.  so if you nest two map functions (that use
> different ranges) inside of eachother you get a resulting curve that is
> flat in those two ranges (below 10 and above 20) and returns the actual
> field value in the middle.
>
> : (I chose a field with 0 and 100 as limits and tried with that. So,
> replaced
> : infinities with 0 and 100 respectively)
> :
> : sort=map(map(myNumField,-Infinity,10,0),20,Infinity,0) desc, score desc
> :
> : If I needed Sorted results in ascending order, Results around the value
> 10
> : ranked above those of 20, what should I do in this case?
> :
> : I tried giving,
> : sort=map(map(myNumField,-Infinity,10,0),20,Infinity,0) *asc*, score desc
> : But, that does not seem to work quite as I expected.
>
> Hmmm... ok.  FWIW: anytime you say things like "does not seem to work
> quite as I expected" ... you really need to explain: a) what you expected.
> b) what you got.
>
> But i think i see the problem...
>
> if you change to asc, then it's going to sort docs by the result of that
> function asc, and because of the map a *lot* of docs are going to have a
> value of "0" for that function -- so in addition to changing to "asc"
> you'll want to change the target value of that function to something above
> the upper endpoint of the range you care about (20 in this example)
>
> so if the range of legal values is 0-100, and you care about 10-20
>
> sort=map(map(myNumField,0,10,0),20,100,0) desc, score desc
> sort=map(map(myNumField,0,10,100),20,100,100) asc, score desc
>
>
>
> -Hoss
>



-- 
Sowmya V.B.
----------------------------------------------------
Losing optimism is blasphemy!
http://vbsowmya.wordpress.com
----------------------------------------------------

Reply via email to