lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chris D" <un...@hotmail.com>
Subject Bug in current CVS source with DateField
Date Tue, 26 Nov 2002 16:04:24 GMT

I found that the current code in CVS prevents a 
org.apache.lucene.search.DateFilter from functioning properly.

This fragment is taken from org.apache.lucene.document.DateField


    // Pad with leading zeros
    if (s.length() < DATE_LEN) {
      StringBuffer sb = new StringBuffer(s);
      while (sb.length() < DATE_LEN)
        sb.insert(0, ' ');
      s = sb.toString();
    }


The code is padding ' ' (space) instead of zeros.

Line 5 should be:          sb.insert(0, '0');

Making this change and recompiling gave the expected results.

Looking back,  the lucene-1.2 source uses the following fragment:

    while (s.length() < DATE_LEN)
      s = "0" + s;				  // pad with leading zeros





_________________________________________________________________
Add photos to your messages with MSN 8. Get 2 months FREE*. 
http://join.msn.com/?page=features/featuredemail


--
To unsubscribe, e-mail:   <mailto:lucene-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:lucene-user-help@jakarta.apache.org>


Mime
View raw message