我正在开发一个列出并搜索alfresco文档的应用程序。问题是露天平台每个查询最多可以返回5000条记录。但是我不希望我的应用程序列出所有文档,如果我可以在露天环境中实现分页,那么露天环境每页只返回X结果。我正在使用Alfresco 4企业版。
I am working on an application which lists and searches document from alfresco. The issue is the alfresco can return upto 5000 records per query. but I don't want my application to list down all documents instead if I can some how implement pagination in alfresco, so that alfresco only return X result per page. I am using Alfresco 4 enterprise edition.
请提供任何帮助或建议。
Any help or suggestion please.
更新(示例) 我编写了一个Web脚本,该脚本执行查询并返回满足条件的所有文档。可以说,找到了5000个条目。我想以某种方式修改Web脚本,使Web脚本在第一页返回100个文档,在第二页返回100个文档,依此类推...
UPDATE (Example) I have written a web script which executes the query and returns all the documents satisfies the condition. Lets say, there are 5000 entries found. I want to modify my web script in a way that the web script returns 100 documents for 1st page, next 100 for second page and so on...
类似于使用Limit BY和OFFSET关键字。类似于此
It'll be something like usage of Limit BY and OFFSET keywords. something like this
推荐答案有两种方法可以在 SearchService (不包括selectNodes / selectProperties调用)。一种方法是直接为查询方法指定所有参数。这样做的好处是简洁,但缺点是您无法获得所有选择。
There are two ways to query on the SearchService (excluding the selectNodes/selectProperties calls). One way is to specify all your arguments directly to the query method. This has the advantage of being concise, but the disadvantage is that you don't get all the options.
或者,您可以查询,其中带有 SearchParameters 对象。这使您可以执行简单查询所要做的一切,以及更多。其中包括setLimit,setSkipCount和setMaxItems,它们将允许您进行分页。
Alternately, you can query with a SearchParameters object. This lets you do everything the simple query does, and more. Included in that more are setLimit, setSkipCount and setMaxItems, which will allow you to do your paging.
如果您的查询以前是这样的:
If your query used to be something like:
searchService.query(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, "lucene", myQuery);您应该执行以下操作:
SearchParameters sp = new SearchParameters(); sp.addStore(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE); sp.setLanguage("lucene"); sp.setQuery(myQuery); sp.setMaxItems(100); sp.setSkipCount(900); searchService.query(sp);更多推荐
露天分页
发布评论