lucene-solr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Solr Wiki] Update of "FunctionQuery" by YonikSeeley
Date Sun, 18 Oct 2009 15:38:50 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Solr Wiki" for change notification.

The "FunctionQuery" page has been changed by YonikSeeley.
The comment on this change is: document ms.
http://wiki.apache.org/solr/FunctionQuery?action=diff&rev1=22&rev2=23

--------------------------------------------------

      Example Syntax: '''linear(x,2,4)'''  returns 2*x+4
  
  == recip ==
- A reciprocal function with '''recip(myfield,m,a,b)''' implementing a/(m*x+b).  m,a,b are
constants, x is any arbitrarily complex function.
+ A reciprocal function with '''recip(x,m,a,b)''' implementing a/(m*x+b).  m,a,b are constants,
x is any numeric field or arbitrarily complex function.
  
  When a and b are equal, and x>=0, this function has a maximum value of 1 that drops as
x increases. Increasing the value of a and b together results in a movement of the entire
function to a flatter part of the curve. These properties can make this an ideal function
for boosting more recent documents when x is rord(datefield).
      Example Syntax: '''recip(rord(creationDate),1,1000,1000)'''
+ 
+ <!> [[Solr1.4]]
+ In Solr 1.4 and later, best practice is to avoid ord() and rord() and derive the boost directly
from the value of the date field.
+ See ms() for more details.
  
  == max ==
  max(x,c) returns the max of another function and a constant.  Useful for "bottoming out"
another function at some constant.
      Example Syntax: '''max(myfield,0)'''
+ 
+ == ms ==
+ <!> [[Solr1.4]]
+ 
+ Returns milliseconds of difference between it's arguments.
+ 
+ Dates are relative to the Unix or POSIX time epoch, midnight, January 1, 1970 UTC.
+ 
+ Arguments may be numerically indexed date fields such as !TrieDate (the default in 1.4),
or date math (examples in SolrQuerySyntax) based on a constant date or '''NOW'''.
+ 
+ '''ms()'''
+   Equivalent to '''ms(NOW)''', number of milliseconds since the epoch.
+ '''ms(a)'''
+   Returns the number of milliseconds since the epoch that the argument represents.
+ 
+   Example: '''ms(NOW/DAY)'''
+ 
+   Example: '''ms(2000-01-01T00:00:00Z)'''
+  
+   Example: '''ms(mydatefield)'''
+ '''ms(a,b)'''
+   Returns the number of milliseconds that {{{b}}} occurs before {{{a}}} (i.e. {{{a - b}}}).
 Note that this offers higher precision than '''sub(a,b)''' because the arguments are not
converted to floating point numbers before subtraction.
+ 
+   Example: '''ms(NOW,mydatefield)'''
+ 
+   Example: '''ms(mydatefield,2000-01-01T00:00:00Z)'''
+ 
+   Example: '''ms(datefield1,datefield2)'''
  
  == top ==
  <!> [[Solr1.4]]

Mime
View raw message