Aron,
I believe we now have class ExtendedFieldCacheImpl extends FieldCacheImpl 
implements ExtendedFieldCache
And this should support sorting by longs.

Otis
--
Sematext -- http://sematext.com/ -- Lucene - Solr - Nutch

----- Original Message ----
From: Aron Sogor <[EMAIL PROTECTED]>
To: java-user@lucene.apache.org
Sent: Tuesday, January 15, 2008 8:37:49 AM
Subject: Re: Sort does not work for me

Lucky guy who gets the same problem.

Found the issue:
http://issues.apache.org/jira/browse/LUCENE-463

Lucene see numbrs in the field and thinks it is an int... than
 overflows 
the int.
Force the sort field to be a SortField.String.
Aron Sogor wrote:
> Let me qualify my question:
>
> Sort is not working for a field that I stored :
>
>           document.add(new Field(FIELD_RECEIVED,
 DateTools.timeToString(
>                   System.currentTimeMillis(), 
> DateTools.Resolution.SECOND),
>                   Field.Store.NO, Field.Index.UN_TOKENIZED));
>
> using the query bellow with sort:
> Sort sort = new Sort(FIELD_RECEIVED,true);
>
> even if I do reverse=false the order of the hits does not really 
> change. The question is why would that be. The dates are numbers that
 
> even is sorted as strings should order the same, and reverse should
 work.
>
> Aron
>
>
>
> Aron Sogor wrote:
>> 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]
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


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





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

Reply via email to