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 JanHoydahl
Date Tue, 17 Apr 2012 13:49:14 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 JanHoydahl:
http://wiki.apache.org/solr/FunctionQuery?action=diff&rev1=83&rev2=84

  === numdocs ===
  '''numdocs()''' returns the number of documents in the index, not including those that are
marked as deleted but have not yet been purged.  This is a constant (the same value for all
documents in the index).
  
+ == Boolean Functions ==
+ <!> [[Solr4.0]]
+ 
+ These are functions which helps do boolean logic acting on true/false and conditions. Note
that they do not only work for pure {{{true/false}}} values but interpret 0 as false and positive
number as true.
+ 
+ === true ===
+ '''true''' returns true
+ 
+ === false ===
+ '''false''' returns false
+ 
+ === exists ===
+ '''exists(field|function)''' returns true if a value exists for a given document.
+ 
+ Example use: {{{exists(myField)}}} will return if myField has a value, while {{{exists(query(year:2012))}}}
will return true for docs with year=2012.
+ 
+ === if ===
+ '''if(expression,trueValue,falseValue)''' emits trueValue if the expression is true, else
falseValue. An expression can be any function which outputs boolean values, or even functions
returning numeric values, in which case value 0 will be interpreted as false, or strings,
in which case empty string is interpreted as false.
+ 
+ Example use: {{{if(exists(myField),100,0)}}} returns 100 if myField exists
+ 
+ === def ===
+ '''def(field|function,defaultValue)''' returns the value of field "field", or if the field
does not exist, returns the defaultValue specified.
+ 
+ Example use: {{{def(rating,5)}}} The def() function will here return the rating, or if no
rating specified in the doc, returns 5
+ 
+ === not ===
+ '''not(function|field)''' returns the inverse of expression.
+ 
+ Examples: {{{not(true)}}} returns false, {{{not(inStock))}}} returns true (or 1.0) for docs
with inStock=false, and false (or 0.0) for the others.
+ 
+ === and ===
+ '''and(x,y)''' returns true if both x and y are true
+ 
+ === or ===
+ '''or(x,y)''' returns true if either x or y are true
+ 
  == dist ==
  [[Solr3.1]]
  

Mime
View raw message