<commit_before>var Bot = require('node-telegram-bot');
var unirest = require('unirest');
var algoliasearch = require('algoliasearch');

var client = algoliasearch('applicationID', '0H4SMABBSG');
var index = client.initIndex('Post_production');


var bot = new Bot({
  token: '<KEY>'
})
.on('message', function (message) {
  console.log(message);
  index.search(message.text, function searchDone(err, content) {
    console.log(err, content);
  });
  var caps = message.text.toUpperCase();
  var answer = {
      chat_id : message.chat.id,
      text : "You told be to do something, so I took your input and made it all caps. Look: " + caps
  };
    bot.sendMessage(answer,function(){
    console.log("sucess of the india");
  });
})
.start();<commit_msg>Adding search API and send message with top 5 results<commit_after>var Bot = require('node-telegram-bot');
var unirest = require('unirest');
var algoliasearch = require('algoliasearch');

var client = algoliasearch('0H4SMABBSG', '9670d2d619b9d07859448d7628eea5f3');
var index = client.initIndex('Post_production');


var bot = new Bot({
  token: '<KEY>'
})
.on('message', function (message) {
  console.log(message);
  index.search(message.text, function searchDone(err, content) {
    console.log(err, content);
    var hits = content.hits;
    var answerText = "\n";
    for (var i = 0; i < 5; i++) {
      j = i+1;
      answerText = answerText + "\n"+j+". "+ hits[i].name + " - "+hits[i].tagline +"\n"+ hits[i].url+"\n";
    }
    var answer = {
        chat_id : message.chat.id,
        disable_web_page_preview : true,
        text : "Here you go! Top five results for "+message.text+ answerText
    };
      bot.sendMessage(answer,function(){
      console.log("sucess of the india");
  });
  var caps = message.text.toUpperCase();

  });
})
.start();
{'fraction_non_alphanumeric': 0.16326530612244897, 'fraction_numerical': 0.01709873138444567, 'mean_word_length': 3.7736842105263158, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 5, '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': '709598', 'n_tokens_mistral': 630, 'n_tokens_neox': 610, 'n_words': 151}