package de.netpioneer.socialmedia.twitter.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.social.twitter.api.SearchResults;
import org.springframework.social.twitter.api.Tweet;
import org.springframework.social.twitter.api.Twitter;
import org.springframework.stereotype.Service;

@Service
public class TwitterService {
	
	@Autowired
	private Twitter twitter;

	public List<Tweet> findTweetsByKeyword(String keyword) {
		SearchResults searchResults = twitter.searchOperations().search(keyword, 100);
		List<Tweet> tweets = searchResults.getTweets();
		return tweets;
	}
	
}

@@ -132,16 +132,155 @@
 owired;%0A
+import org.springframework.social.twitter.api.SearchParameters;%0Aimport org.springframework.social.twitter.api.SearchParameters.ResultType;%0A
 import o
@@ -332,16 +332,16 @@
 esults;%0A
-
 import o
@@ -626,16 +626,152 @@
 word) %7B%0A
+%09%09SearchParameters searchParameters = new SearchParameters(keyword)%0A%09%09%09%09.resultType(ResultType.RECENT)%0A%09%09%09%09.lang(%22en%22)%0A%09%09%09%09.count(100);%0A
 %09%09Search
@@ -832,20 +832,24 @@
 rch(
-keyword, 100
+searchParameters
 );%0A%09

Improve search to contain the 100 most recent tweets in English language.