gpt4 book ai didi

amazon-dynamodb - DynamoDB 中的分页

转载 作者:行者123 更新时间:2023-12-04 22:33:35 27 4
gpt4 key购买 nike

我需要在 jsp 上显示最大计数为 10 的搜索结果,并且它应该有一个分页来作为分页功能来回遍历。

Dynamodb 有一个 最后评估 key ,但返回上一页无济于事,尽管我可以通过 移动到下一个结果集lastevaluatedKey .

任何人都可以请帮忙。

我使用 Java SPRING 和 DynamoDB 作为堆栈。

谢谢
萨蒂亚

最佳答案

要启用前进/后退,您只需要保持
the first key , 即 hash key + sort key先前返回页面的第一条记录(如果您要查询第一页,则为 null)。


the last key检索到的页面,即 hash key + sort key之前返回页面的最后一条记录

然后要向前或向后导航,您需要在查询请求中传入以下参数:
Forward: last key as the ExclusiveStartKey, order = ascendBackward: first key as the ExclusiveStartKey, order = descend
我在 2016 年的一个项目中实现了这一点。DynamoDB 现在可能会提供一些类似的方便的 API,但我不确定,因为我很长时间没有检查 DynamoDB。

关于amazon-dynamodb - DynamoDB 中的分页,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14396346/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com