Here is the document:

MimeMessage mime = new MimeMessage(null, new FileInputStream(item
                   .getMailFile()));
document.add(new Field(FIELD_MAILID, item.getMailId().toString(),
                   Field.Store.YES, Field.Index.UN_TOKENIZED));
           document.add(new Field(FIELD_SUBJECT, mime.getSubject(),
                   Field.Store.COMPRESS, Field.Index.TOKENIZED));
document.add(new Field(FIELD_FROM, getAddressLine(mime.getFrom()),
                   Field.Store.COMPRESS, Field.Index.TOKENIZED));
           document.add(new Field(FIELD_BODY, getContentReader(mime
                   .getContent())));
           document.add(new Field(FIELD_RECEIVED, DateTools.timeToString(
System.currentTimeMillis(), DateTools.Resolution.SECOND),
                   Field.Store.NO, Field.Index.UN_TOKENIZED));
           document.add(new Field(FIELD_TAG, TAG_INBOX, Field.Store.YES,
                   Field.Index.TOKENIZED));
           return document;

here is the search:

   public static Hits createInboxQuery(IndexSearcher searcher)
           throws ParseException, IOException {
       Query query = new QueryParser(FIELD_TAG, new StandardAnalyzer())
               .parse(TAG_INBOX);
       Sort sort = new Sort(FIELD_RECEIVED,true);
       return searcher.search(query, sort);
   }

IndexSearcher searcher = storage.getIndexSearcherForMailBox("junk");
           Hits hits = DocumentAndQueryFactory.createInboxQuery(searcher);
           for (int i = 0; i < hits.length(); i++) {
               Document hit = (Document) hits.doc(i);
               System.out.println(hit.getField("subject").stringValue());


No matter what I do when I lit the hits they come back (these are the subjects/ but essentially same timestamp):

Test MSGSun Jan 13 15:52:47 PST 2008
Test MSGSun Jan 13 15:52:54 PST 2008
Test MSGSun Jan 13 15:53:03 PST 2008
Test MSGSun Jan 13 15:53:12 PST 2008
Test MSGSun Jan 13 15:53:48 PST 2008

Setting the "revert" for the search Sort essentially has no effect. I perhaps very much missing something... but what?

Aron

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to