如何解决DynamoDB 扫描忽略大写或小写字母
我的老板让我做一个不识别大小写字母的过滤器,我添加了以下代码,使过滤器可以识别大小写字母的使用,但没有找到任何东西
DynamoDBMapper mapper = new DynamoDBMapper(amazonDynamoDB);
DynamoDBScanExpression scanExpression = new DynamoDBScanExpression();
Map<String,AttributeValue> eav = new HashMap<String,AttributeValue>();
Map<String,String> ean = new HashMap<String,String>();
StringJoiner where = new StringJoiner(" and ");
if (status != null) {
eav.put(":status",new AttributeValue().withS(status));
where.add("#status = :status");
ean.put("#status","status");
scanExpression.withExpressionAttributeNames(ean);
}
if (where.length() > 0) {
scanExpression.withFilterExpression(where.toString()).withExpressionAttributeValues(eav).withConsistentRead(false);
}
// Scan to the end of the page after the requested page
int scanTo = (int) (pageable.getOffset() + (2 * pageable.getPageSize()));
解决方法
DynamoDB 现在区分大小写,正如您在此 thread 中看到的那样。
进行此搜索的另一种方法是保存另一个大写/小写字段并将搜索更改为此字段。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。