lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Karsten Konrad" <Karsten.Kon...@xtramind.com>
Subject AW: Better way to Sort by Date
Date Fri, 10 Oct 2003 14:47:34 GMT

Hello,

>>
ok, good idea, but how can i do that?
>>

that really depends on where you get your documents from.
Sorry, as this is quite an unspecific problem, I can not
give specific code.

If, for instance, the documents come from a database, you could 
use the SQL-Query to compute an ordered list of document 
id's sorted by date - then you can create a new index and 
insert each document one by one by the order given by the list.

In general, if no such external sorting mechanism exists, I would 
make a Java sorter class that holds some link to the document (such as 
its filename or URL or whatever) and its date (from wherever you have 
that info). Make sure that the class implements Comparable and write
the  compareTo-method such that it compares the dates appropriately. 
Then for each document you have, create a sorter object and put it 
into a TreeSet. After you have added all sorter objects, you have a 
sorted collection of the documents and can insert them in order into a 
Lucene index.

Clear?

Karsten



-----Ursprüngliche Nachricht-----
Von: none none [mailto:korfut@lycos.com] 
Gesendet: Freitag, 10. Oktober 2003 16:21
An: Lucene Developers List
Betreff: Re: Better way to Sort by Date


ok, good idea, but how can i do that?
any examples? 
thank you,

--

--------- Original Message ---------

DATE: Fri, 10 Oct 2003 09:18:33
From: "Karsten Konrad" <Karsten.Konrad@xtramind.com>
To: "Lucene Developers List" <lucene-dev@jakarta.apache.org>,<korfut@lycos.com>
Cc: 

>
>Hi,
>
>the fastest way would be to build your index such that the documents 
>are inserted in the order of their date. You can then sort a search 
>result very quickly by date by sorting the document numbers in the 
>result.
>
>Regards,
>
>Mit freundlichen Grüßen aus Saarbrücken
>
>--
>
>Dr.-Ing. Karsten Konrad
>Head of Artificial Intelligence Lab
>
>XtraMind Technologies GmbH
>Stuhlsatzenhausweg 3
>D-66123 Saarbrücken
>Phone: +49 (681) 3025113
>Fax: +49 (681) 3025109
>konrad@xtramind.com
>www.xtramind.com
>
>Besuchen Sie uns auf der SYSTEMS!
>20.-24. Oktober 2003, Neue Messe München
>Halle A1, Stand 518
>
>
>
>
>-----Ursprüngliche Nachricht-----
>Von: none none [mailto:korfut@lycos.com]
>Gesendet: Freitag, 10. Oktober 2003 06:50
>An: lucene-dev@jakarta.apache.org
>Betreff: Better way to Sort by Date
>
>
>hi all,
>what is the fastest way to sort results by date?
>anybody implemented it yet? any good performance?
>
>thank you,
>Korfut.
>
>
>
>____________________________________________________________
>Get advanced SPAM filtering on Webmail or POP Mail ... Get Lycos Mail! 
>http://login.mail.lycos.com/r/referral?aid=27005
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: lucene-dev-help@jakarta.apache.org
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: lucene-dev-help@jakarta.apache.org
>
>



____________________________________________________________
Get advanced SPAM filtering on Webmail or POP Mail ... Get Lycos Mail! http://login.mail.lycos.com/r/referral?aid=27005

---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-dev-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-dev-help@jakarta.apache.org


Mime
View raw message