Esempio n. 1
0
 public void onStatus(twitter4j.Status status) {
   Logger.info(status.getUser().getName() + " : " + status.getText());
   Tweet tweet = new Tweet(status);
   tweet.conformsToTerms = checkMatch(status);
   tweet.save();
   if (tweet.conformsToTerms && esClient != null) {
     String json = DataObjectFactory.getRawJSON(status);
     json =
         json.replaceAll(
             "(\"geo\":\\{\"type\":\"Point\",\"coordinates\":)\\[([-0-9.,]*)\\]", "$1\"$2\"");
     // Logger.debug("geo mangled json");
     // Logger.debug(json);
     IndexResponse response =
         esClient.prepareIndex("twitter", "tweet").setSource(json).execute().actionGet();
   }
 }
Esempio n. 2
0
 public static Result list(int page, int pageSize) {
   Page<Tweet> currentPage = Tweet.page(page - 1, pageSize);
   // List<Tweet> tweets = Tweet.find.where().eq("conformsToTerms",true).orderBy("date
   // desc").findList();
   StreamConfig config = getConfig();
   String terms = config.listTermsAsString();
   return ok(stream_result_list.render(currentPage, page, pageSize, terms));
 }