<commit_before>/**
 * Created by ken on 5/26/15.
 */
//$(document).ready(function(){
//    $.ajax({
//        url: "https://api.mongolab.com/api/1/databases/whiskey/collections/whiskies",
//        data: {
//            apiKey: "<KEY>",
//            q: '{whiskey: "Glenlivet"}'
//        },
//        success: function(data) {
//            displayTours(data);
//        }
//    })
//});

var getTours = function(toursOffset, numOfTours) {
    $.ajax({
        url: "https://api.mongolab.com/api/1/databases/whiskey/collections/whiskies",
        data: {
            apiKey: "<KEY>",
            q: "{whiskey: {$exists: true}}",
            sk: toursOffset,
            l: numOfTours
        },
        success: function(data) {
            displayTours(data);
        }
    })
};

$('#tags').on('keypress', function(){
    var searchTerm = $('#tags').val();
    $.ajax({
        url: "https://api.mongolab.com/api/1/databases/whiskey/collections/whiskies",
        data: {
            apiKey: "<KEY>",
            q: '{$or: [' +
            '{whiskey: {$regex: "' + searchTerm + '", $options: "i"}},' +
            '{location: {$regex: "' + searchTerm + '", $options: "i"}},' +
            '{price: {$regex: "' + searchTerm + '", $options: "i"}},' +
            '{type: {$regex: "' + searchTerm + '", $options: "i"}},' +
            '{flavor: {$regex: "' + searchTerm + '", $options: "i"}}' +
            ']' +
            '}',
            l:1
        },
        success: function(data) {
            if(searchTerm.length >= 2){
                $('.tour, .target').detach();<commit_msg>#1 User can search through site<commit_after>/**
 * Created by ken on 5/26/15.
 */
//$(document).ready(function(){
//    $.ajax({
//        url: "https://api.mongolab.com/api/1/databases/whiskey/collections/whiskies",
//        data: {
//            apiKey: "<KEY>",
//            q: '{whiskey: "Glenlivet"}'
//        },
//        success: function(data) {
//            displayTours(data);
//        }
//    })
//});

var getTours = function(toursOffset, numOfTours) {
    $.ajax({
        url: "https://api.mongolab.com/api/1/databases/whiskey/collections/whiskies",
        data: {
            apiKey: "<KEY>",
            q: "{whiskey: {$exists: true}}",
            sk: toursOffset,
            l: numOfTours
        },
        success: function(data) {
            displayTours(data);
        }
    })
};

$('#tags').on('keypress', function(){
    var searchTerm = $('#tags').val();
    $.ajax({
        url: "https://api.mongolab.com/api/1/databases/whiskey/collections/whiskies",
        data: {
            apiKey: "<KEY>",
            q: '{$or: [' +
            '{whiskey: {$regex: "' + searchTerm + '", $options: "i"}},' +
            '{location: {$regex: "' + searchTerm + '", $options: "i"}},' +
            '{price: {$regex: "' + searchTerm + '", $options: "i"}},' +
            '{type: {$regex: "' + searchTerm + '", $options: "i"}},' +
            '{flavor: {$regex: "' + searchTerm + '", $options: "i"}}' +
            ']' +
            '}'
        },
        success: function(data) {
            if(searchTerm.length >= 2){
                $('.tour, .target').detach();
{'fraction_non_alphanumeric': 0.2237960339943343, 'fraction_numerical': 0.006295247088448221, 'mean_word_length': 1.718562874251497, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 11, 'https://': 6, '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': '285390', 'n_tokens_mistral': 1062, 'n_tokens_neox': 1057, 'n_words': 173}