private void copyStaticTweets() {
Module module = new DefaultModule();
Injector injector = Guice.createInjector(module);
Provider<RMIClient> rmiProvider = injector.getProvider(RMIClient.class);
Configuration cfg = injector.getInstance(Configuration.class);
TwitterSearch twSearch = injector.getInstance(TwitterSearch.class);
twSearch.initTwitter4JInstance(cfg.getTwitterSearchCredits().getToken(),
cfg.getTwitterSearchCredits().getTokenSecret(), true);
ElasticTweetSearch fromUserSearch = new ElasticTweetSearch(injector.getInstance(Configuration.class));
JetwickQuery query = new TweetQuery().addFilterQuery(ElasticTweetSearch.UPDATE_DT, "[* TO *]");
// TODO set facetlimit to 2000
query.addFacetField("user").setSize(0);
SearchResponse rsp = fromUserSearch.query(query);
TermsFacet tf = (TermsFacet) rsp.getFacets().facet("user");
logger.info("found: " + tf.entries().size() + " users with the specified criteria");
int SLEEP = 30;
int counter = 0;
for (TermsFacet.Entry tmpUser : tf.entries()) {
if (tmpUser.getCount() < 20)
break;
while (twSearch.getRateLimit() <= 3) {
try {
logger.info("sleeping " + SLEEP + " seconds to avoid ratelimit violation");
Thread.sleep(1000 * SLEEP);
} catch (InterruptedException ex) {
throw new IllegalStateException(ex);