AnsweredAssumed Answered

Pagination on search with webservices

Question asked by spilby on Feb 17, 2011
Hi,

I'm trying to implement a search method using the Alfresco Webservices. I have something like this:

RepositoryServiceSoapBindingStub repositoryService = WebServiceFactory.getRepositoryService();

Reference ref = new Reference(store, sNodeId, null);
Predicate predicate = new Predicate(new Reference[]{ref}, store, null);
Node[] nodes = repositoryService.get(predicate);

String sQuery = sQueryPath + " AND " + sQueryConditions;

Query query = new Query(Constants.QUERY_LANG_LUCENE, sQuery);
QueryResult queryResult = repositoryService.query(store, query, false);


I want to paginate these results. I know the fetchMore method but have the problem that I can't obtain, for example, the results from 40 to 50. I need to start from first position and call 4 times fetchMore to obtain the results of page 4.

Other possiblity is this:

SearchParameters sp = new SearchParameters();
sp.addStore(SPACES_STORE);
sp.setLanguage(SearchService.LANGUAGE_LUCENE);
sp.setQuery(sQuery);
ResultSet results = searchService.query(sp);


but I need WEB SERVICES methods, and I think that this isn't. I don't know how can I obtain the searchService, because I'm not change the core code of Alfresco. Only call the webservice throw my application.

¿Is possible to use SearchParameters or something similar with web services? ¿Or how could I paginate with webservice? ¿The unique solution is using X calls to fetchMore?

Thank you very much!

Outcomes