The map function maps the values in the specified range of a field to the target value.
Common usage:
Map (x, min, max, target) and map (x, min, max, target, other)
For example:
Map (x, 0, 0, 1) maps the value of x in the function parameter to 1 if it is 0, which is useful when the default value is 0.
If map (x, 10,100, 10,100) falls between [] in the function parameter, the value of x is mapped to 1; otherwise, the value is mapped to 2.
Usage:
Generally used for sorting
Sort = sum (value, map (age, 10, 10, $ x, $ y) + asc & x = 2 & y = 3
If the value of the age field is 10, the value is mapped to 2. Otherwise, the value is 3, and the value is added, which is sorted in ascending order.
Sort = sum (value, map (age, 10, 10, $ x, $ y) + asc & x = sum (2, some_field * 2) & y = 3
Similar to the intention in the previous example, the x value is generated through a function.
The map function is used to influence the score field and sort the score.
Http://dev.aifang.com: 8487/solr/loupan/select /? Q = {! Func} map (loupan_id, 1004,1004, 1,100) & fl = *, score & sort = score + asc, loupan_id + desc
Sort by map directly in sort
Http://dev.aifang.com: 8487/solr/loupan/select /? Q = *: * & fl = *, score & sort = map (loupan_id, 1004,1004, 1,100) + asc