You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by amit rohatgi <so...@gmail.com> on 2008/12/11 03:35:57 UTC

Ordinal Field value and exact value for date.

Hi All,

I am trying to use ord() function query ord() on created_date.  I am
concrened with the warning of ord behaviour as it uses actual entry creation
in indices instead of created_date value.

Does all entries created initially with different created_date will have
same or nearly ordinal value? If yes then how is the age calculation for the
document works?
Does creation of   index should have knowledge of creation date of document
while adding into indices?

Thanks
amit

Re: Ordinal Field value and exact value for date.

Posted by Chris Hostetter <ho...@fucit.org>.
: I am trying to use ord() function query ord() on created_date.  I am
: concrened with the warning of ord behaviour as it uses actual entry creation
: in indices instead of created_date value.

I'm not sure what you mean by "entry creation" the ord function returns 
the orinal value ... an "low" date value will have a lower ordinal value 
then a "high" date value -- regardless of when the document was added.  

: Does all entries created initially with different created_date will have
: same or nearly ordinal value? If yes then how is the age calculation for the

two docs with equal date values will have the same ordinal value.

Imagine you have 4 docs, with the following date values

doc#1  2001-11-29T09:22:55.0Z
doc#2  1990-01-20T11:22:55.0Z
doc#3  1990-03-25T14:22:55.0Z
doc#4  1990-01-20T11:22:55.0Z  (same as doc#2)

there are 3 unique date values, so there are three ordinal values...

doc#1  3
doc#2  1
doc#3  2
doc#4  1

the key to understand is that even though there is a much smaller gap 
between 1990-01-20 and 1990-03-25 then there is between 1990-03-25 and 
2001-11-29, the odrinal difference is still just "1" because they in both 
cases the values are "1 away" in the set of all known values.

the result is that the ordinal function results in a linear 
function over documents in the order of the date field.


-Hoss