lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Uwe Schindler" <...@thetaphi.de>
Subject RE: Pagination and Sorting
Date Thu, 01 Oct 2009 12:25:15 GMT
Hi Chris,

> Uwe,
> 
> > You are using TopDocs incorrectly. Normally you use *not*
> Integer.MAX_VALUE,
> > as the upper bound of your pagination window as numer of documents. So
> if
> > user wants to display documents 90 to 100, just set the number to 100
> docs.
> > If the user then goes to docs 100 to 110, just reexecute ther query with
> a
> > larger value. [...] If somebody goes further, just raise and reexecute
> query.
> 
> That's what I thought of as workaround for the first pages.

That's not a workaround, it is designed to work like this!

> But at
> some point the user might want to see the last page of the results,
> so eventually I will have to call
> 
>   TopDocs topDocs = indexSearcher.search(query, null, 300500, sort);
> 
> and still run into an error. Right now I'd present the user with an
> error message like "The search returned too many results, please further
> restrict your search" but a more generic solution would sound a lot
> better ;)

How about sorting backwards in this case (and print out the page in reverse
to get a forward-printed page again)?

Uwe


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


Mime
View raw message