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 2008/09/23 20:50:28 UTC

[Solr Wiki] Update of "FunctionQuery" by JamesBrady

Dear Wiki user,

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

The following page has been changed by JamesBrady:
http://wiki.apache.org/solr/FunctionQuery

The comment on the change is:
A bit more explanation about ord and rord - always confused me!

------------------------------------------------------------------------------
      SolrQuerySyntax Example: '''_val_:myFloatField'''
  
  === ord ===
- ord(myfield) returns the ordinal of the indexed field value within the indexed list of terms for that field in lucene index order (lexicographically ordered by unicode value), starting at 1.  The field must have a maximum of one value per document (not multiValued).  0 is returned for documents without a value in the field.
+ ord(myfield) returns the ordinal of the indexed field value within the indexed list of terms for that field in lucene index order (lexicographically ordered by unicode value), starting at 1. In other words, for a given field, all values are ordered lexicographically; this function then returns the offset of a particular value in that ordering. The field must have a maximum of one value per document (not multiValued).  0 is returned for documents without a value in the field.
-    Example: If there were only three field values: "apple","banana","pear" then ord("apple")=1, ord("banana")=2, ord("pear")=3 
+    Example: If there were only three values for a particular field: "apple","banana","pear", then ord("apple")=1, ord("banana")=2, ord("pear")=3 
  
     Example Syntax: '''ord(myIndexedField)'''
  
@@ -42, +42 @@

  === rord ===
  The reverse ordering of what ord provides.
      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.
  
  === sum ===
  <!> ["Solr1.3"]