You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by dn...@apache.org on 2004/09/05 23:47:57 UTC
cvs commit: jakarta-lucene/src/demo/org/apache/lucene/demo HTMLDocument.java FileDocument.java
dnaber 2004/09/05 14:47:57
Modified: src/demo/org/apache/lucene/demo HTMLDocument.java
FileDocument.java
Log:
use the new DateTools class to limit the date resolution and save the date in a readable format
Revision Changes Path
1.6 +2 -1 jakarta-lucene/src/demo/org/apache/lucene/demo/HTMLDocument.java
Index: HTMLDocument.java
===================================================================
RCS file: /home/cvs/jakarta-lucene/src/demo/org/apache/lucene/demo/HTMLDocument.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- HTMLDocument.java 1 Sep 2004 22:27:44 -0000 1.5
+++ HTMLDocument.java 5 Sep 2004 21:47:57 -0000 1.6
@@ -53,7 +53,8 @@
// Add the last modified date of the file a field named "modified".
// Use a field that is indexed (i.e. searchable), but don't tokenize
// the field into words.
- doc.add(new Field("modified", DateField.timeToString(f.lastModified()),
+ doc.add(new Field("modified",
+ DateTools.timeToString(f.lastModified(), DateTools.Resolution.MINUTE),
Field.Store.YES, Field.Index.UN_TOKENIZED));
// Add the uid as a field, so that index can be incrementally maintained.
1.7 +5 -4 jakarta-lucene/src/demo/org/apache/lucene/demo/FileDocument.java
Index: FileDocument.java
===================================================================
RCS file: /home/cvs/jakarta-lucene/src/demo/org/apache/lucene/demo/FileDocument.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- FileDocument.java 2 Sep 2004 21:33:57 -0000 1.6
+++ FileDocument.java 5 Sep 2004 21:47:57 -0000 1.7
@@ -19,9 +19,9 @@
import java.io.File;
import java.io.FileReader;
+import org.apache.lucene.document.DateTools;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
-import org.apache.lucene.document.DateField;
/** A utility for making Lucene Documents from a File. */
@@ -33,8 +33,8 @@
<li><code>path</code>--containing the pathname of the file, as a stored,
untokenized field;
<li><code>modified</code>--containing the last modified date of the file as
- a keyword field as encoded by <a
- href="lucene.document.DateField.html">DateField</a>; and
+ a field as created by <a
+ href="lucene.document.DateTools.html">DateTools</a>; and
<li><code>contents</code>--containing the full contents of the file, as a
Reader field;
*/
@@ -51,7 +51,8 @@
// Add the last modified date of the file a field named "modified". Use
// a field that is indexed (i.e. searchable), but don't tokenize the field
// into words.
- doc.add(new Field("modified", DateField.timeToString(f.lastModified()),
+ doc.add(new Field("modified",
+ DateTools.timeToString(f.lastModified(), DateTools.Resolution.MINUTE),
Field.Store.YES, Field.Index.UN_TOKENIZED));
// Add the contents of the file to a field named "contents". Specify a Reader,
---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-dev-help@jakarta.apache.org