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 ChrisHarris.
The comment on this change is: Clarifying a few more date things: 1) RE 
Negative #s for dates before the epoch, 2) handling of missing dates.
http://wiki.apache.org/solr/FunctionQuery?action=diff&rev1=61&rev2=62

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

  
  For non-numeric fields, fields are still evaluated to a numeric value. How 
this works depends on the field type:
  
-  * For new date fields (i.e. those based on the TrieDateField class), the 
fieldvalue behavior is as follows: If the document has a value in that field, 
then the numeric field value is the number of milliseconds(?) between that date 
and the epoch. If the document has no value in that field, then the numeric 
field value is 0. (That is, the default==0 convention still holds for dates.)
+  * For new date fields (i.e. those based on the TrieDateField class), the 
fieldvalue behavior is as follows: If the document has a value in that field, 
then the numeric field value is the number of milliseconds(?) between that date 
and the epoch. (This number can be negative for documents dated before the 
epoch.) If the document has no value in that field, then the numeric field 
value is 0. (That is, the default==0 convention still holds for dates. This has 
the side-effect of making undated documents act as if they were dated 
1970-01-01T00:00:00Z.)
-  * For "classic" date fields (i.e. those based on DateField or 
LegacyDateField), the fieldvalue value is not a function of the date field 
itself; rather, it gives the "ord" ordinal ranking of that field's value. (See 
"ord".) The default==0 convention still holds.
+  * For "classic" date fields (i.e. those based on DateField or 
LegacyDateField), the fieldvalue value is not a function of the date field 
itself; rather, it gives the "ord" ordinal ranking of that field's value. (See 
"ord".) The default==0 convention still holds. (This has the side-effect of 
making undated documents act as if they were the oldest documents in the index.)
   * For boolean fields (e.g. solr.BoolField), the fieldvalue behavior may not 
be what you expect. In particular, don't assume that true maps to 1.0 and false 
to 0.0. At least on a pre-1.4 build, Chris Harris noted that true was mapping 
to 2.0. The justification (from debugQuery=on) is as follows: " 2.0 = 
ord(inStock)=2".
  
  == ord ==
@@ -200, +200 @@

   Example: '''ms(NOW/DAY)'''
   . Example: '''ms(2000-01-01T00:00:00Z)'''
   . Example: '''ms(mydatefield)'''
+ 
+ Note that this number can be negative for dates from before the epoch.
  
  '''ms(a,b)'''
  

Reply via email to