I forgot to mention: Because of this, e.g. even Google (who do not use Lucene :-]) does not let you go beyond a limit to a very large page number.
----- Uwe Schindler H.-H.-Meier-Allee 63, D-28213 Bremen http://www.thetaphi.de eMail: u...@thetaphi.de > -----Original Message----- > From: Uwe Schindler [mailto:u...@thetaphi.de] > Sent: Thursday, October 01, 2009 2:25 PM > To: java-user@lucene.apache.org > Subject: RE: Pagination and Sorting > > 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-unsubscr...@lucene.apache.org > For additional commands, e-mail: java-user-h...@lucene.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org