1
votes

I've been looking at the documentation for AWS DynamoDB QueryRequest at: http://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/com/amazonaws/services/dynamodbv2/model/QueryRequest.html#getQueryFilter()

This documentation suggests that addQueryFilterEntry is a valid function inside the QueryRequest class. However, the symbol seems to be missing in the Dynamo DB V2 jars that I am using. Does anyone have any suggestions as to what I should do to filter the search results before returning them? I'd rather not loop through the results and remove the invalid results in the application layer.

My code looks something like below:

import com.amazonaws.services.dynamodbv2.model.QueryRequest;

String hashKey = Utilities.normalize(user_id);

Condition hashKeyCondition = new Condition()
    .withComparisonOperator(ComparisonOperator.EQ.toString())
    .withAttributeValueList(new AttributeValue().withS(hashKey));

Map<String, Condition> keyConditions = new HashMap<String, Condition>();
keyConditions.put("UserId", hashKeyCondition);

// Gets count of all matching results.
QueryRequest queryRequest = new QueryRequest().withTableName(storiesTable)
    .withKeyConditions(keyConditions)
    .withSelect(Select.COUNT)
    .withConsistentRead(true);
QueryResult result = dynamoDB.query(queryRequest);
int countResults = result.getCount();

I wanted to add: queryRequest = queryRequest.addQueryFilterEntry(key, Condition) and this is not compiling reporting error finding the symbol.

2
what version of the SDK are you using?Chen Harel
I meant the exact version. The latest is 1.8.3. Make sure you use the latest when browsing the latest documentation.Chen Harel
Ahh.. I think thats the catch then. I will upgrade my jars.. Generally, this is better done with creating separate documentation per release specially if you are adding new methods or classes etc.. This should have been part of the next release. No?user1328995

2 Answers

2
votes

Make sure you upgrade to the newest AWS Java SDK (as of 10-Jul-2014 it's 1.8.3) before tackling the latest documentation site.

0
votes

you need to give more details.

make sure you are importing the latest QueryRequest

import com.amazonaws.services.dynamodbv2.model.QueryRequest;