<commit_before>require 'httparty'
require "active_support/core_ext"

while true do
  two_minutes_ago = (Time.now - 2.minutes).strftime "%Y%m%dT%H:%M:%S"
  three_minutes_ago = (Time.now - 3.minutes).strftime "%Y%m%dT%H:%M:%S"

  query = {query: {range: { postDate: {from: "#{three_minutes_ago}", to: "#{two_minutes_ago}"}}}}.to_json
  puts query

  response = HTTParty.get("http://localhost:9200/twitter/tweet/_search", body: query)
  puts response.body
<commit_msg>nicely  print out number of hits found<commit_after>require 'httparty'
require "active_support/core_ext"

while true do
  two_minutes_ago = (Time.now - 2.minutes).strftime "%Y%m%dT%H:%M:%S"
  three_minutes_ago = (Time.now - 3.minutes).strftime "%Y%m%dT%H:%M:%S"

  query = {query: {range: { postDate: {from: "#{three_minutes_ago}", to: "#{two_minutes_ago}"}}}}.to_json
  puts query

  response = HTTParty.get("http://localhost:9200/twitter/tweet/_search", body: query)
  parsed = JSON.parse(response.body)
  puts parsed["hits"]["total"]
{'fraction_non_alphanumeric': 0.1798201798201798, 'fraction_numerical': 0.011988011988011988, 'mean_word_length': 5.549019607843137, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5951777', 'n_tokens_mistral': 402, 'n_tokens_neox': 378, 'n_words': 70}