//older than or newer than?
if (currentSearch.isFirstScan())
query.setMaxId(currentSearch.getMaxID());
else
query.setSinceId(currentSearch.getSinceID());
QueryResult result;
try {
result = twitter.search(query);
int size = result.getTweets().size();
logger.warning("-- Going to iterate on "+ size + " tweets");
if (size==0) {
logger.warning("-- REACHED "+ size + " tweets");
return;
}
else if(size==1)
{
logger.warning("-- REACHED "+ size + " tweets");
currentSearch.setFirstScan(false);
pushSearch(currentSearch);
return;
}
List<Status> tweets = result.getTweets();
for (Status tweet : tweets) {
System.out.println("@" + tweet.getUser().getScreenName()
+ " - " + tweet.getText());
logger.warning("-- "+ tweet.getText());