cancel
Showing results for 
Search instead for 
Did you mean: 

Lucene search custom paging webscript.

fserrano
Champ in-the-making
Champ in-the-making
Hi, I am trying to do a results pagination in one of our webscripts (with an HTML template). The search definition is the following:

var sort1 =
   {
      column: FIELD_MODIFIED,
      ascending: false
   };
   var paging =
   {
    maxItems: limit,
    skipCount: start + (pagesize * (page-1))
   };
   var def =
   {
    query: "+TYPE:\"" + CUSTOM_TYPE + "\"",
    store: "workspace://SpacesStore",
    sort: [sort1],
    page: paging
   };

It is working correctly, but I would like to know if is there any way to get the total amount of results ( the number it would obtain without applying any limit nor filters). The point would be implementing a pagination system in the html (but I need to know how many elements of type CUSTOM_TYPE are there in the repository without running the query unfiltered again). Any ideas? Thanks in advance.
FSerrano.
2 REPLIES 2

openpj
Elite Collaborator
Elite Collaborator
If you implement the WebScript using Java, you can get all the information you need for the result set:
http://wiki.alfresco.com/wiki/Java-backed_Web_Scripts_Samples

Hope this helps.

fserrano
Champ in-the-making
Champ in-the-making
If you implement the WebScript using Java, you can get all the information you need for the result set:
http://wiki.alfresco.com/wiki/Java-backed_Web_Scripts_Samples

Hope this helps.
Thanks for the answer. I will do that, so I can have more control over the results I want to return for the pagination.