Hi I modified the guestbook full text search to use executeWithMap()
and it works fine. However, I would like to add a contains clause to
the hashmap (on a different column). I am not getting the result as
expected... Can you please let me know if contains clause (basically a
list of strings) can be used with the guestbook full text search
example.
Code:
int parameterCounter = 0;
Map args = new HashMap();
while (parameterCounter < queryTokens.size()) {
queryBuffer.append("fts == param" +
parameterCounter);
declareParametersBuffer.append("String param"
+ parameterCounter);
args.put("param" + parameterCounter,
parametersForSearch.get(parameterCounter));
if (parameterCounter + 1 < queryTokens.size())
{
queryBuffer.append(" && ");
declareParametersBuffer.append(", ");
}
parameterCounter++;
}
//Upto now, I have used the code from existing example. However, I
added args so that it uses hashmap.
//the next three lines, I am extending args to use contains() clause
for userName in the list provided.
//It stops at "Hi...."
declareParametersBuffer.append(",
java.util.List<String> strList");
queryBuffer.append(" && :strList.contains(userName)");
args.put("strList", strList);
Query query = pm.newQuery(queryBuffer.toString());
query.declareParameters(declareParametersBuffer.toString());
List<ItemDesc> result = null;
System.out.println(queryBuffer.toString() + " " +
queryString);
try {
System.out.println("Hi...");
result = (List<ItemDesc>)
query.executeWithMap(args);
System.out.println("Hi....1");
System.out.println(result.size());
} catch (DatastoreTimeoutException e) {
log.severe(e.getMessage());
log.severe("datastore timeout at: " +
queryString);// + " - timestamp: " + discreteTimestamp);
} catch(DatastoreNeedIndexException e) {
log.severe(e.getMessage());
log.severe("datastore need index exception at:
" + queryString);// + " - timestamp: " + discreteTimestamp);
}
--
You received this message because you are subscribed to the Google Groups
"Google App Engine" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-appengine?hl=en.