0

我的老板让我制作一个不识别大小写字母的过滤器,我添加了以下代码来制作过滤器但识别大小写字母的使用并且没有找到任何东西

    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()));
4

1 回答 1

1

DynamoDB 现在区分大小写,正如您在此线程中看到的那样。

进行此搜索的另一种方法是使用大写/小写保存另一个字段并将您的搜索更改为该字段。

于 2021-06-25T22:56:29.747 回答