1

I am using Spring Social to have twitter search. In my controller I have:

@RequestMapping(value="/twitter/search", method=RequestMethod.GET)
public String showTweets(@RequestParam("query") String query, Model model) {
    TwitterTemplate twitterTemplate = new TwitterTemplate();
    SearchResults searchResults = twitterTemplate.searchOperations().search(query);

    List<Tweet> tweets = searchResults.getTweets();
    model.addAttribute("query", query);
    model.addAttribute("timeline", tweets);
    return "twitter/timeline";
}

however it returns an empty list of tweets. What am I doing wrong here?

mahsa.teimourikia
  • 1,664
  • 9
  • 32
  • 64

1 Answers1

2

It doesn't look like you're doing anything wrong. But it kind of depends on what the query is. I'd bet if you search for "fdshfjads" you won't find much. But if you search for "#VineApp", there'd probably be more than a few tweets.

Out of curiosity, which version of Spring Social Twitter are you using?

Craig Walls
  • 2,080
  • 1
  • 12
  • 13
  • I'm searching Obama, and I tried the queries on twitter search also and they return tweets, however, in my app nothing happens! I'm using 1.0.2.RELEASE version... – mahsa.teimourikia Jun 06 '13 at 19:55
  • I also changed the version to 1.0.1.RELEASE and checked the dependency conflicts, but no luck! Any suggestions? – mahsa.teimourikia Jun 06 '13 at 20:15