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: remove JIRA URLs, add pointers to SolrSpatial. http://wiki.apache.org/solr/FunctionQuery?action=diff&rev1=69&rev2=70 -------------------------------------------------- = Sort By Function = - <!> [[Solr3.1]] (https://issues.apache.org/jira/browse/SOLR-1297) + <!> [[Solr3.1]] It is now possible to sort the results by the output of a function. For instance, if an application wanted to sort by distance, it could do: {{{ @@ -254, +254 @@ See the java.util.Math javadocs for more details. == dist == - [[Solr3.1]] See: https://issues.apache.org/jira/browse/SOLR-1302 + [[Solr3.1]] Return the Distance between two Vectors (points) in an n-dimensional space. See http://en.wikipedia.org/wiki/Lp_space for more information. Takes in the power, plus two or more !ValueSource instances and calculates the distances between the two vectors. Each !ValueSource must be a number. There must be an even number of !ValueSource instances passed in and the method assumes that the first half represent the first vector and the second half represent the second vector. @@ -280, +280 @@ 1. dist(1,x,y,z,e,f,g) - Euclidean distance between (x,y,z) and (e,f,g) where each letter is a field name + See Solr's SpatialSearch for easy to use geospatial search features. + == sqedist - Squared Euclidean Distance == - [[Solr3.1]] See: https://issues.apache.org/jira/browse/SOLR-1302 + [[Solr3.1]] Similar to the dist() function, the Sq. Euclidean distance calculates the 2-norm (Euclidean distance) but does not take the square root, thus saving a fairly expensive operation. It is often the case that applications that care about Euclidean distance do not need the actual distance, but instead can use the square of the distance. See also dist(). There must be an even number of !ValueSource instances passed in and the method assumes that the first half represent the first vector and the second half represent the second vector. @@ -290, +292 @@ Example: sqedist(x_td, y_td, 0, 0) == hsin, ghhsin - Haversine Formula == - [[Solr3.1]] See: https://issues.apache.org/jira/browse/SOLR-1302 + [[Solr3.1]] The Haversine distance calculates the distance between two points on a sphere when traveling along the sphere. In other words, it's the Great Circle distance. See http://en.wikipedia.org/wiki/Great-circle_distance. In the case of !GeohashHaversine, the sources must be a geohash value. '''Values must be in Radians'''. See the rad() function. Please note Haversine distance has known problems with antipodal values. See the Wikipedia page for details. - Signature: hsin(radius, true|false, x1,y1,x2,y2), ghhsin(radius, hash1, hash2) //pre SOLR-1131, the radius was the last value. + Signature: hsin(radius, true|false, x1,y1,x2,y2), ghhsin(radius, hash1, hash2) - The boolean value determines whether hsin will automatically convert the input values from degrees to radians. See https://issues.apache.org/jira/browse/SOLR-2114, which changed the signature slightly from the earlier, unreleased form. + The boolean value determines whether hsin will automatically convert the input values from degrees to radians. Example: hsin(2, true, x, y, 0, 0) - Calculate the haversine distance between the lat/lon 0, 0 on a sphere of radius 2 and the values in field x,y, converting the values automatically to radians. + + See Solr's SpatialSearch for easy to use geospatial search features. == 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. @@ -357, +361 @@ === Distances === - dist(), hsine() and sqedist() can work with !MultiValueSources + dist(), hsine() and sqedist() can work with vector functions (implemented in Java via !MultiValueSource ) - - See the !MultiValueSource class. - - See https://issues.apache.org/jira/browse/SOLR-1131 -
