: 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

Reply via email to