cancel
Showing results for 
Search instead for 
Did you mean: 

Search and Paging

kasperba
Champ in-the-making
Champ in-the-making
I am having a bit of a problem with lucene and paging.

I need to be able to specify that I only want the resultset for example page 5 and that there is like 10 items on each page.

I have seen that you can do it with opensearch but how do you do it with lucene?
4 REPLIES 4

mark_smithson
Champ in-the-making
Champ in-the-making
Lucene does not support paging.

What you can do though, is run the search then skip results until you get to the page you are interested in.

kasperba
Champ in-the-making
Champ in-the-making
thanks for you answer.

Skipping rows is an awful solution, but if there is no other then that will have to do.

But to me it looks like a limitation in Alfresco since I can find examples of how to do paging with Lucene.

mark_smithson
Champ in-the-making
Champ in-the-making
Hi,

As far as I am aware paging in lucene would involve just displaying the relevant results for the current page (effectively skipping rows), or have you found an example which does something different?

Lucene is quick, we can page results with thousands of result with very little impact on performance.

You can use the examples you have found about paging in lucene. Alfresco makes it possible for you to get to the hits and documents in the lucene results for a search.

kevinr
Star Contributor
Star Contributor
The way Lucene performs its "scoring" means that it needs the full resultset to be able to judge the score of documents. OpenSearch is simply paging through the query results each time - it's not great but it works. As far as performance is concerned, 4/5 of the CPU time will be taken up by permissions evaluations in the repository - not Lucene itself. You can configure Alfresco to stop processing permissions after a certain number or time taken and ignore the rest - as the results will be returned in score order anyway - and let's be honest, most users don't want to see more than a few pages of results in any UI.

Thanks,

Kevin