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 ChrisHarris
Date Fri, 16 Apr 2010 18:39:49 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 ChrisHarris.
The comment on this change is: Clarify that "classic" date fields *do* have "ord" behavior
for fieldvalue..
http://wiki.apache.org/solr/FunctionQuery?action=diff&rev1=57&rev2=58

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

   . Example Syntax: '''myFloatField'''
   . SolrQuerySyntax Example: '''_val_:myFloatField'''
  
+ For non-numeric fields, fields are still evaluated to a numeric value. How this works depends
on the field type:
+ 
- For date fields, 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. 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 "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 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".
+  * 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 ==
  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.

Mime
View raw message