Search for Specific KeyWords


#1

Hi, I want to search for more than 1 keyword but in a separate tweet. For example if I have 2 specific keywords I want to search - cat, dog. I know how to retrieve tweets that consists of Cat. But now I want to search more than 1 keyword, how should I do it? I tried to add another try catch but it does not work. The result is not correct.
The following is my codes for searching 1 keyword.

try {
Query query = new Query(“cat”);
QueryResult result;
do {
result = twitter.search(query);
List tweets = result.getTweets();
for (Status tweet : tweets) {
System.out.println("@" + tweet.getUser().getScreenName() + " -> " + tweet.getText());
// String json = DataObjectFactory.getRawJSON(tweet);
// System.out.println(json);
}
} while ((query = result.nextQuery()) != null);
System.exit(0);
} catch (TwitterException te) {
te.printStackTrace();
System.out.println("Failed to search tweets: " + te.getMessage());
System.exit(-1);
}