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] Trivial Update of "FunctionQuery" by YonikSeeley
Date Tue, 17 Nov 2009 14:48:03 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: fix formatting caused by initial use of gui mode.
http://wiki.apache.org/solr/FunctionQuery?action=diff&rev1=35&rev2=36

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

  == rord ==
  The reverse ordering of what ord provides.
  
+  . Example Syntax: '''rord(myIndexedField)'''
-  . Example Syntax: '''rord(myIndexedField)''' Example: '''rord(myDateField)''' is a metric
for how old a document is: the youngest document will return 1, the oldest document will return
the total number of documents.
+  . Example: '''rord(myDateField)''' is a metric for how old a document is: the youngest
document will return 1, the oldest document will return the total number of documents.
  
  WARNING: as of Solr 1.4, ord() and rord() can cause excess memory use since they must use
a FieldCache entry at the top level reader, while sorting and function queries now use entries
at the segment level.  Hence sorting or using a different function query, in addition to ord()/rord()
will double memory use.
  
  == sum ==
  <!> [[Solr1.3]] sum(x,y,...) returns the sum of multiple functions.
  
-  . Example Syntax: '''sum(x,1)''' Example Syntax: '''sum(x,y)''' Example Syntax: '''sum(sqrt(x),log(y),z,0.5)'''
+  . Example Syntax: '''sum(x,1)'''
+  . Example Syntax: '''sum(x,y)'''
+  . Example Syntax: '''sum(sqrt(x),log(y),z,0.5)'''
  
  == sub ==
  <!> [[Solr1.4]] sub(x,y) returns x-y
  
-  . Example: '''sub(myfield,myfield2)''' Example: '''sub(100,sqrt(myfield))'''
+  . Example: '''sub(myfield,myfield2)'''
+  . Example: '''sub(100,sqrt(myfield))'''
  
  == product ==
  <!> [[Solr1.3]] product(x,y,...) returns the product of multiple functions.
  
-  . Example Syntax: '''product(x,2)''' Example Syntax: '''product(x,y)'''
+  . Example Syntax: '''product(x,2)'''
+  . Example Syntax: '''product(x,y)'''
  
  == div ==
  <!> [[Solr1.3]] div(x,y) divides the function x by the function y.
  
+  . Example Syntax: '''div(1,x)'''
-  . Example Syntax: '''div(1,x)''' Example Syntax: '''div(sum(x,100),max(y,1))'''
+  . Example Syntax: '''div(sum(x,100),max(y,1))'''
  
  == pow ==
  <!> [[Solr1.3]] pow(x,y) raises the base x to the power y.
  
-  . Example Syntax: '''pow(x,0.5)'''   same as sqrt Example Syntax: '''pow(x,log(y))'''
+  . Example Syntax: '''pow(x,0.5)'''   - same as sqrt
+  . Example Syntax: '''pow(x,log(y))'''
  
  == abs ==
  <!> [[Solr1.3]] abs(x) returns the absolute value of a function.
  
-  . Example Syntax: '''abs(-5)''' Example Syntax: '''abs(x)'''
+  . Example Syntax: '''abs(-5)'''
+  . Example Syntax: '''abs(x)'''
  
  == log ==
  <!> [[Solr1.3]] log(x) returns log base 10 of the function x.
  
-  . Example Syntax: '''log(x)''' Example Syntax: '''log(sum(x,100))'''
+  . Example Syntax: '''log(x)'''
+  . Example Syntax: '''log(sum(x,100))'''
  
  == sqrt ==
  <!> [[Solr1.3]] sqrt(x) returns the square root of the function x
  
-  . Example Syntax: '''sqrt(2)''' Example Syntax: '''sqrt(sum(x,100))'''
+  . Example Syntax: '''sqrt(2)'''
+  . Example Syntax: '''sqrt(sum(x,100))'''
  
  == map ==
  <!> [[Solr1.3]] map(x,min,max,target) maps any values of the function x that fall
within min and max inclusive to target.  min,max,target are constants. It outputs the field's
value if it does not fall between min and max.
  
+  . Example Syntax 1: '''map(x,0,0,1)'''  change any values of 0 to 1... useful in handling
default 0 values
-  . Example Syntax 1: '''map(x,0,0,1)'''  change any values of 0 to 1... useful in handling
default 0 values Example Syntax 2 <!> [[Solr1.4]]: '''map(x,0,0,1,0)'''  change any
values of 0 to 1 . and if the value is not zero it can be set to the value of the 5th argument
instead of defaulting to the field's value
+  . Example Syntax 2 <!> [[Solr1.4]]: '''map(x,0,0,1,0)'''  change any values of 0
to 1 . and if the value is not zero it can be set to the value of the 5th argument instead
of defaulting to the field's value
  
  == scale ==
  <!> [[Solr1.3]] scale(x,minTarget,maxTarget) scales values of the function x such
that they fall between minTarget and maxTarget inclusive.
  
+  . Example Syntax: '''scale(x,1,2)'''  all values will be between 1 and 2 inclusive.
+  . '''NOTE''': The current implementation currently traverses all of the function values
to obtain the min and max so it can pick the correct scale.
-  . Example Syntax: '''scale(x,1,2)'''  all values will be between 1 and 2 inclusive. NOTE:
The current implementation currently traverses all of the function values to obtain the min
and max so it can pick the correct scale. NOTE: This implementation currently cannot distinguish
when documents have been deleted or documents that have no value, and 0.0 values will be used
for these cases.  This means that if values are normally all greater than 0.0, one can still
end up with 0.0 as the min value to map from.  In these cases, an appropriate map() function
could be used as a workaround to change 0.0 to a value in the real range.  example: '''scale(map(x,0,0,5),1,2)'''
+  . '''NOTE''': This implementation currently cannot distinguish when documents have been
deleted or documents that have no value, and 0.0 values will be used for these cases.  This
means that if values are normally all greater than 0.0, one can still end up with 0.0 as the
min value to map from.  In these cases, an appropriate map() function could be used as a workaround
to change 0.0 to a value in the real range.  example: '''scale(map(x,0,0,5),1,2)'''
  
  == query ==
  <!> [[Solr1.4]] query(subquery, default) returns the score for the given subquery,
or the default value for documents not matching the query.  Any type of subquery is supported
through either parameter dereferencing {{{$otherparam}}} or direct specification of the query
string in the LocalParams via "v".
@@ -141, +154 @@

  '''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)'''
+  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)'''
+  . 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)'''
  
  === Date Boosting ===
  Boosting more recent content is a common use case.  One way is to use a {{{recip}}} function
in conjunction with {{{ms}}}.

Mime
View raw message