You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Peter Carlson <ca...@bookandhammer.com> on 2002/06/20 06:55:09 UTC

Re: search bean and sorting

Hi,

I currently use the SearchBean code (although I did refactor much of the
code in the contribution) to sort by date.

Your same code should work if you created a field "formattedDate"

Again, I haven't tested this new refactored code, so let me know if you run
into any problems.

--Peter

On 6/19/02 12:19 PM, "Srinivas.Kotamraju@bmsus.com"
<Sr...@bmsus.com> wrote:

> hi carlson,
> i have seen your code contribution in the lucene sand box. I thank you for
> sharing it will all other developers.I am thinking of using it, but I am
> wondering If the sorting mechanism for a field you have implemented would
> also work for Dates? please let me know.
> I have a bunch of html files with metags like <META NAME="ISSUE_DATE"
> CONTENT="3/25/2002">
> and I am parsing the files and adding the dates using the DateField to my
> index.. 
> 
> doc.add(Field.Keyword("date",DateField.dateToString(formattedDate)));
> 
> I want the hits returned, to be sorted by date? would a call to ur
> code..like below..give me the results sorted by date?
> thanks in advance.
> srini
> SearchBean sb = new SearchBean(index,formattedDate);
> HitsIterator hi = sb.search("metal");
> while (hi.hasNext())
> { Document doc = hi.next(); }
> 
> 
> 
> 
> 
> 
> 


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>