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
That is impossible.We just use lucene in my project at the monent.Maybe in the
future we change to solr.anyway thanks for your advice
2011-09-21
janwen | China
website : http://www.qianpin.com/
-
一键发送本地文件,请用网易闪电邮(fm.163.com)!
发件人: Ma
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
: http://www.qianpin.com/
发件人: Ian Lea
发送时间: 2011-09-21 16:27
主 题: Re: Re: search match documents and pagination in lucene3.x
收件人: java-user@lucene.apache.org
The n in search(Query query, int n) specifies the number of hits
(docs) you want returned. There is no point in lucene
totalHits = searcher.search( query,searcher.maxDoc()).scoreDocs.length