You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-commits@lucene.apache.org by Apache Wiki <wi...@apache.org> on 2009/11/20 20:34:00 UTC

[Solr Wiki] Update of "FunctionQuery" by YonikSeeley

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: brief descriptions of the math functions.
http://wiki.apache.org/solr/FunctionQuery?action=diff&rev1=38&rev2=39

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

   . SolrQuerySyntax Example: '''_val_:1.5'''
  
  == literal ==
- 
  <!> [[Solr1.5]] String literals.  Warning: not all functions can work with string literals.
  
+ Signature:  literal(value), "value", 'value' Example:  'foo', literal("this is a literal")
- Signature:  literal(value), "value", 'value'
- Example:  'foo', literal("this is a literal")
  
  == fieldvalue ==
  This function returns the numeric field value of an indexed field with a maximum of one value per document (not multiValued).  The syntax is simply the field name by itself.  0 is returned for documents without a value in the field.
@@ -182, +180 @@

  Also see http://wiki.apache.org/solr/SolrRelevancyFAQ#How_can_I_boost_the_score_of_newer_documents
  
  == Math.* ==
+ <!> [[Solr1.5]]
  
  Most Java Math functions are now supported, including:
-  1. rad
-  1. deg
-  1. sqrt
+ 
+  1. rad - convert degrees to radians
+  1. deg- convert radians to degrees
+  1. sqrt - square root
   1. cbrt - cube root
-  1. log
+  1. log - base10 log
   1. ln - natural log
-  1. exp
-  1. sin
-  1. cos
-  1. tan
-  1. asin
-  1. acos
-  1. atan
-  1. sinh
-  1. cosh
-  1. tanh
-  1. ceil
-  1. floor
-  1. rint
-  1. pow
-  1. hypot
-  1. atan2
+  1. exp - Euler's number raised to a power
+  1. sin - trigonometric sine of an angle in radians
+  1. cos - cosine of an angle
+  1. tan - tangent of an angle
+  1. asin - arc sine
+  1. acos - arc cosine
+  1. atan- arc tangent
+  1. sinh - hyperbolic sine
+  1. cosh - hyperbolic cosine
+  1. tanh - hyperbolic tangent
+  1. ceil - ceiling, rounds up to an integer
+  1. floor - rounds down to an integer
+  1. rint - rounds to the nearest integer
+  1. pow(x,y) - raises x to the power of y (x**y)
+  1. hypo(x,y) - returns sqrt(x**2+y**2) without intermediate overflow or underflow
+  1. atan2(x,y) - returns the angle resulting from the conversion of the rectangular coordinates x,y to polar coordinates
  
  See the java.util.Math javadocs for more details.
  
@@ -256, +256 @@

  
  Example: hsin(x, y, 0, 0, 1) - Calculate the haversin distance between the lat/lon 0, 0 and the values in field x,y with a radius of 1.
  
- == Deg/Rad - Convert to Degrees/Radians ==
- [[Solr1.5]] See: https://issues.apache.org/jira/browse/SOLR-1302
  
- Given a value in degrees, convert it to radians and vise-versa.
- 
- Signature: deg(!ValueSource), rad(!ValueSource)
  
  == geohash - Convert to geohash ==
- 
  Given a latitude and longitude (in degrees, not radians), convert them to a Geohash.  See http://en.wikipedia.org/wiki/Geohash.
  
  Signature: geohash(ValueSource, ValueSource)

Re: [Solr Wiki] Update of "FunctionQuery" by YonikSeeley

Posted by Yonik Seeley <yo...@lucidimagination.com>.
On Fri, Nov 20, 2009 at 2:34 PM, Apache Wiki <wi...@apache.org> wrote:
>  == literal ==
> -
>  <!> [[Solr1.5]] String literals.  Warning: not all functions can work with string literals.
>
> + Signature:  literal(value), "value", 'value' Example:  'foo', literal("this is a literal")
> - Signature:  literal(value), "value", 'value'
> - Example:  'foo', literal("this is a literal")

Hey, I didn't do that!  I'll fix.
Looks like we need to use "." instead of a newline when we want
something on a new line... that's what the GUI mode ends up putting
in.

-Yonik
http://www.lucidimagination.com