pagination

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

pagination

Kainth, Sachin
Hello,

I was wondering if Lucene provides any mechanism which helps in
pagination.  In other words is there a way to return the first 10 of 500
results and then the  next 10 and so on.

Cheers


This email and any attached files are confidential and copyright protected. If you are not the addressee, any dissemination of this communication is strictly prohibited. Unless otherwise expressly agreed in writing, nothing stated in this communication shall be legally binding.

The ultimate parent company of the Atkins Group is WS Atkins plc.  Registered in England No. 1885586.  Registered Office Woodcote Grove, Ashley Road, Epsom, Surrey KT18 5BW.

Consider the environment. Please don't print this e-mail unless you really need to.
Reply | Threaded
Open this post in threaded view
|

Re: pagination

Erick Erickson
See TopDocs, HitCollector, etc. Don't iterate through a Hits objects to get
docs beyond, say, 100 since it's designed to efficiently return the first
100 documents but re-executes the queries each 100 or so times you advance
to the next document.

Erick

On 2/21/07, Kainth, Sachin <[hidden email]> wrote:

>
> Hello,
>
> I was wondering if Lucene provides any mechanism which helps in
> pagination.  In other words is there a way to return the first 10 of 500
> results and then the  next 10 and so on.
>
> Cheers
>
>
> This email and any attached files are confidential and copyright
> protected. If you are not the addressee, any dissemination of this
> communication is strictly prohibited. Unless otherwise expressly agreed in
> writing, nothing stated in this communication shall be legally binding.
>
> The ultimate parent company of the Atkins Group is WS Atkins
> plc.  Registered in England No. 1885586.  Registered Office Woodcote Grove,
> Ashley Road, Epsom, Surrey KT18 5BW.
>
> Consider the environment. Please don't print this e-mail unless you really
> need to.
>
Reply | Threaded
Open this post in threaded view
|

RE: pagination

Kainth, Sachin
I might be missing something because TopDocs seems to only be about
finding the relevancy of documents and HitCollector doesn't seem to be
relavent either.

-----Original Message-----
From: Erick Erickson [mailto:[hidden email]]
Sent: 21 February 2007 13:08
To: [hidden email]
Subject: Re: pagination

See TopDocs, HitCollector, etc. Don't iterate through a Hits objects to
get docs beyond, say, 100 since it's designed to efficiently return the
first 100 documents but re-executes the queries each 100 or so times you
advance to the next document.

Erick

On 2/21/07, Kainth, Sachin <[hidden email]> wrote:

>
> Hello,
>
> I was wondering if Lucene provides any mechanism which helps in
> pagination.  In other words is there a way to return the first 10 of
> 500 results and then the  next 10 and so on.
>
> Cheers
>
>
> This email and any attached files are confidential and copyright
> protected. If you are not the addressee, any dissemination of this
> communication is strictly prohibited. Unless otherwise expressly
> agreed in writing, nothing stated in this communication shall be
legally binding.
>
> The ultimate parent company of the Atkins Group is WS Atkins plc.  
> Registered in England No. 1885586.  Registered Office Woodcote Grove,
> Ashley Road, Epsom, Surrey KT18 5BW.
>
> Consider the environment. Please don't print this e-mail unless you
> really need to.
>


This message has been scanned for viruses by MailControl - (see
http://bluepages.wsatkins.co.uk/?6875772)

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: pagination

is_maximum
In reply to this post by Kainth, Sachin
Hi
I've overcome this problem without HitCollector, I build an interface just
like java.sql.ResultSet and its implementation class accept a Hits as
parameter and provide next() previous() etc. method to navigate between
records.
in my opinion this is a good solution.
Hope this help you


On 2/21/07, Kainth, Sachin <[hidden email]> wrote:

>
> Hello,
>
> I was wondering if Lucene provides any mechanism which helps in
> pagination.  In other words is there a way to return the first 10 of 500
> results and then the  next 10 and so on.
>
> Cheers
>
>
> This email and any attached files are confidential and copyright
> protected. If you are not the addressee, any dissemination of this
> communication is strictly prohibited. Unless otherwise expressly agreed in
> writing, nothing stated in this communication shall be legally binding.
>
> The ultimate parent company of the Atkins Group is WS Atkins
> plc.  Registered in England No. 1885586.  Registered Office Woodcote Grove,
> Ashley Road, Epsom, Surrey KT18 5BW.
>
> Consider the environment. Please don't print this e-mail unless you really
> need to.
>



--
Regards,
Mohammad
--
Regards
Mohammad
Pixelshot
Reply | Threaded
Open this post in threaded view
|

Re: pagination

Erik Hatcher
In reply to this post by Erick Erickson
I'll add that in a web application that using Hits to page through  
results is perfectly acceptable.  Going to these other APIs is a bit  
more complicated and often unnecessary.  Don't prematurely optimize!  :)

        Erik


On Feb 21, 2007, at 8:07 AM, Erick Erickson wrote:

> See TopDocs, HitCollector, etc. Don't iterate through a Hits  
> objects to get
> docs beyond, say, 100 since it's designed to efficiently return the  
> first
> 100 documents but re-executes the queries each 100 or so times you  
> advance
> to the next document.
>
> Erick
>
> On 2/21/07, Kainth, Sachin <[hidden email]> wrote:
>>
>> Hello,
>>
>> I was wondering if Lucene provides any mechanism which helps in
>> pagination.  In other words is there a way to return the first 10  
>> of 500
>> results and then the  next 10 and so on.
>>
>> Cheers
>>
>>
>> This email and any attached files are confidential and copyright
>> protected. If you are not the addressee, any dissemination of this
>> communication is strictly prohibited. Unless otherwise expressly  
>> agreed in
>> writing, nothing stated in this communication shall be legally  
>> binding.
>>
>> The ultimate parent company of the Atkins Group is WS Atkins
>> plc.  Registered in England No. 1885586.  Registered Office  
>> Woodcote Grove,
>> Ashley Road, Epsom, Surrey KT18 5BW.
>>
>> Consider the environment. Please don't print this e-mail unless  
>> you really
>> need to.
>>


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: pagination

Peter W.-3
In reply to this post by Kainth, Sachin
Hello,

This snippet may help to understand TopDocs:

<a href="http://mail-archives.apache.org/mod_mbox/lucene-general/200508.mbox/%">http://mail-archives.apache.org/mod_mbox/lucene-general/200508.mbox/% 
[hidden email]%3E

Also, paging through Lucene results is 'do-it-yourself' exercise using
hits.length() until someone contributes a good implementation.

Oversimplifying, if you want 10 hits per page:

hitsperpage equals ten;

-if hits length is less than ten, you have one page
-else if hits length/hitsperpage modulos is 0, that's your pagecount
-else hits length/hitsperpage is your pagecount, modulos is for your  
last page

You will also need a variable to keep track of which page you are on  
and a static
method which returns min/max values to be included in your iteration  
loop.

You can also see my previous attempt at solving this:

http://www.gossamer-threads.com/lists/lucene/java-user/43595

Regards,

Peter W.

On Feb 21, 2007, at 6:32 AM, Kainth, Sachin wrote:

> I might be missing something because TopDocs seems to only be about
> finding the relevancy of documents and HitCollector doesn't seem to be
> relavent either.
>
> -----Original Message-----
> From: Erick Erickson [mailto:[hidden email]]
> Sent: 21 February 2007 13:08
> To: [hidden email]
> Subject: Re: pagination
>
> See TopDocs, HitCollector, etc. Don't iterate through a Hits  
> objects to
> get docs beyond, say, 100 since it's designed to efficiently return  
> the
> first 100 documents but re-executes the queries each 100 or so  
> times you
> advance to the next document.
>
> Erick
>
> On 2/21/07, Kainth, Sachin <[hidden email]> wrote:
>>
>> Hello,
>>
>> I was wondering if Lucene provides any mechanism which helps in
>> pagination.  In other words is there a way to return the first 10 of
>> 500 results and then the  next 10 and so on.