露天分页

编程入门 行业动态 更新时间:2024-10-08 04:26:37
本文介绍了露天分页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在开发一个列出并搜索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);

更多推荐

露天分页

本文发布于:2023-11-28 11:00:36,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1642127.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:分页   露天

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!