The n in search(Query query, int n) specifies the number of hits (docs) you want returned. There is no point in lucene accumulating 10,000 if you only want 10 for the first page.
TopDocs.totalHits tells you the total number of hits for the query. If you actually want all the hits, see the thread from a couple of days ago about that. -- Ian. On Wed, Sep 21, 2011 at 9:13 AM, janwen <tom.grade1...@163.com> wrote: > thanks.Ian. > > The number of the results matched the query is the return value: TopDocs > search(Query query, int n) ,the n arg pass to the method means that lucene > just > search the top n results.But i want to get the matched number that is the > whole index returned not the n i pass into the TopDocs search(Query query, > int n) .Hope i clear my issue. > > thanks again > 2011-09-21 > > > > janwen | China > > --------------------------------------------------------- > 网易闪电邮(fm.163.com),免登录、助您同时管理多个邮箱! > > > > 发件人: Ian Lea <ian....@gmail.com> > 发送时间: 2011-09-21 16:08 > 主 题: Re: search match documents and pagination in lucene3.x > 收件人: java-user@lucene.apache.org > > > >> i want to implements pagination like google search result page in my >> project.We use lucene3.3.Here are 2 issue: >> 1.How can i get the number of matched documents > > TopDocs.totalHits > >> 2.What is the best practice for lucene search results pagination > > http://wiki.apache.org/lucene-java/LuceneFAQ#How_do_I_implement_paging.2C_i.e._showing_result_from_1-10.2C_11-20_etc.3F > > > -- > Ian. > > --------------------------------------------------------------------- > 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