How does Solr scale function works? -


solr documentation says scale function:

scales values of function x such fall between mintarget , maxtarget inclusive.

as example says:

scale(x,1,2) values between 1 , 2 inclusive.

my question is, how? if give function number 78.3 , try scale between 1 , 2, how translates 1 2 format?

it go through documents in index (if read source correctly, works complete set of documents , not current result set), find minimum , maxiumum values, scale value in each document when returning between 2 provided numbers.

so if have documents 0, 5, 10 , invokes scale(x, 1, 2), should 1, 1.5 , 2 back.

the actual implementation source:

return (vals.floatval(doc) - minsource) * scale + min; 

Comments

Popular posts from this blog

jOOQ update returning clause with Oracle -

java - Warning equals/hashCode on @Data annotation lombok with inheritance -

java - BasicPathUsageException: Cannot join to attribute of basic type -