diff --git a/src/demo/org/apache/lucene/demo/FileDocument.java b/src/demo/org/apache/lucene/demo/FileDocument.java index 2d68e3ef114..69f1b7ef7cf 100644 --- a/src/demo/org/apache/lucene/demo/FileDocument.java +++ b/src/demo/org/apache/lucene/demo/FileDocument.java @@ -19,9 +19,9 @@ package org.apache.lucene.demo; 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 @@ public class FileDocument {
path
--containing the pathname of the file, as a stored,
untokenized field;
modified
--containing the last modified date of the file as
- a keyword field as encoded by DateField; and
+ a field as created by DateTools; and
contents
--containing the full contents of the file, as a
Reader field;
*/
@@ -51,7 +51,8 @@ public class FileDocument {
// 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,
diff --git a/src/demo/org/apache/lucene/demo/HTMLDocument.java b/src/demo/org/apache/lucene/demo/HTMLDocument.java
index 663b8dea564..72ee49778ee 100644
--- a/src/demo/org/apache/lucene/demo/HTMLDocument.java
+++ b/src/demo/org/apache/lucene/demo/HTMLDocument.java
@@ -53,7 +53,8 @@ public class HTMLDocument {
// 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.