Could able to do that using range query
String end = "253373251260000";//i.e. 11/30/9999, assume that this is max end
date
Term endTerm = new Term("timestamp",end);
RangeQuery rangeQuery = new RangeQuery(null,endTerm,true);
Sort sort = new Sort("timestamp",true);
Filter dupFilter = new DuplicateFilter("id");
Hits hits = searcher.search(rangeQuery,dupFilter,sort);
--- On Mon, 11/10/08, Cool The Breezer <[EMAIL PROTECTED]> wrote:
> From: Cool The Breezer <[EMAIL PROTECTED]>
> Subject: Order the index by timestamp field and Get n documents
> To: [email protected]
> Date: Monday, November 10, 2008, 1:21 AM
> Hi,
> In my index, there is a field called timestamp which is
> long value of date. I am trying to get sort all documents
> by timestamp and get N documents.
> I am trying to find a way to create a query like
> "timestamp > 0" and then order the result by
> timestamp and get N fields. However I am not able to do
> that. Suggest me the best way. Or there are any lowlevel
> method available for the same.
>
> I am using Lucene 2.3.1 and looking into method
> search(Weight weight, Filter filter, int nDocs, Sort sort)
> in IndexSearcher. Trying to know how to create a Weight
> object.
>
> Anyway, I would really appreciate your suggestion....
>
> -RB
>
>
>
>
> ---------------------------------------------------------------------
> 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]