AnsweredAssumed Answered

Pagination of search results in a search web script

Question asked by theorbix on Jul 21, 2008
Latest reply on Mar 25, 2009 by damiar
We’re developing a custom web application for Alfresco.

The application must perform queries on the Alfresco repository using a set of custom attributes and return the result set to the browser.

We have developed a custom web script in JavaScript, that performs the query and returns the search results in HTML (the final version will likely return the results in JSON). See the attached zip file for the source code.

The question now is how to perform the pagination of search results to improve performances.

We have seen that the standard /api/search Web Script provides a parameter for pagination: &p={startPage?}

GET /alfresco/service/search/keyword.html?q={searchTerms}&p={startPage?}&c={count?}&l={language?} 

The Web Script above uses a Java-backed component… Can the same result be achieved in a custom Javascript-backed  component? And what is the correct JavaScript to “fetch” search results in a paginated way?

Outcomes