You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by janwen <to...@163.com> on 2011/09/21 08:42:27 UTC
search match documents and pagination in lucene3.x
Hi:
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
2.What is the best practice for lucene search results pagination
thanks so much.
2011-09-21
janwen | China
website : http://www.qianpin.com/
Re: Re: Re: Re: search match documents and pagination in lucene3.x
Posted by janwen <to...@163.com>.
thanks.Mihai.This is i want.
2011-09-22
janwen | China
website : http://www.qianpin.com/
发件人: Mihai Caraman <ca...@gmail.com>
发送时间: 2011-09-21 19:02
主 题: Re: Re: Re: search match documents and pagination in lucene3.x
收件人: java-user@lucene.apache.org
totalHits = searcher.search( query,searcher.maxDoc()).scoreDocs.length
Re: Re: Re: search match documents and pagination in lucene3.x
Posted by Mihai Caraman <ca...@gmail.com>.
totalHits = searcher.search( query,searcher.maxDoc()).scoreDocs.length
Re: Re: Re: search match documents and pagination in lucene3.x
Posted by janwen <to...@163.com>.
Google results page will show these info:About 439,000,000 results (0.21 seconds)
so i think any application will show the total matched results to the user.Lucene need to think about implement this function?haha
thanks Ian. I will search the mail archive.
2011-09-21
janwen | China
website : http://www.qianpin.com/
发件人: Ian Lea <ia...@gmail.com>
发送时间: 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 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 <to...@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 <ia...@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-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org
Re: Re: search match documents and pagination in lucene3.x
Posted by Ian Lea <ia...@gmail.com>.
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 <to...@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 <ia...@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-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org
Re: Re: search match documents and pagination in lucene3.x
Posted by janwen <to...@163.com>.
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 <ia...@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-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org
Re: Re: search match documents and pagination in lucene3.x
Posted by janwen <to...@163.com>.
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)!
发件人: Manish Bafna <ma...@gmail.com>
发送时间: 2011-09-21 16:15
主 题: Re: search match documents and pagination in lucene3.x
收件人: java-user@lucene.apache.org
You can use SOLR.
On Wed, Sep 21, 2011 at 1:37 PM, Ian Lea <ia...@gmail.com> wrote:
>> 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-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org
Re: search match documents and pagination in lucene3.x
Posted by Manish Bafna <ma...@gmail.com>.
You can use SOLR.
On Wed, Sep 21, 2011 at 1:37 PM, Ian Lea <ia...@gmail.com> wrote:
>> 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-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org
Re: search match documents and pagination in lucene3.x
Posted by Ian Lea <ia...@gmail.com>.
> 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-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org