org.springframework.social.twitter.api.SearchResults Java Examples

The following examples show how to use org.springframework.social.twitter.api.SearchResults. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SearchController.java    From spring-twitter-stream with MIT License 6 votes vote down vote up
@GetMapping(path = "tweet")
public String searchTwitter(Model model, @RequestParam String search) {
	
	int count = 200;
	
    SearchResults results = twitterTemplate.searchOperations().search(
    	    new SearchParameters(search)
    	        .resultType(SearchParameters.ResultType.RECENT)
    	        .count(count));
    
    List<Tweet> tweets = results.getTweets();        
    model.addAttribute("tweets", tweets);
    model.addAttribute("count", count);
    model.addAttribute("search", search);
    
    return "search";
}
 
Example #2
Source File: SocialZwitscherRepository.java    From cloud-native-zwitscher with MIT License 5 votes vote down vote up
@Override
@HystrixCommand(fallbackMethod = "noResults")
public Collection<ZwitscherMessage> search(String q, int pageSize) {
    SearchResults results = twitter.searchOperations().search(q, pageSize);
    return results.getTweets().stream()
            .map(t -> new ZwitscherMessage(t.getUnmodifiedText()))
            .collect(toList());
}
 
Example #3
Source File: Tweets.java    From lemonaid with MIT License 5 votes vote down vote up
public Response(SearchResults results, int count) {
	for (int i = 0; i < results.getTweets().size(); i++) {
		if (statuses == null) this.statuses = new ArrayList<Tweet>(); 
		this.statuses.add(results.getTweets().get(i));
		if (i >= count - 1) break;
	}
	search_metadata = results.getSearchMetadata();
}
 
Example #4
Source File: TwitterClient.java    From lemonaid with MIT License 4 votes vote down vote up
public SearchResults search(String query) { 
	return twitter.searchOperations().search(query);
}
 
Example #5
Source File: Tweets.java    From lemonaid with MIT License 4 votes vote down vote up
public Tweets(SearchResults results, int count) {
	this.response = new Response(results, count);
}