<commit_before>require("../styles/main.styl");
var $ = require("jquery");
var documents = require("./documents");


var beerList =[];
var selectedBeer = null;
var userChoices = {
	color:null,
	bitterness:null,
	alcohol:null,
	hoppyness:null
};
var colors = {
	2: {
		srm: [1, 2],
		name: "<NAME>",
		style: "paleStraw"
	},
	3: {
		srm: [3],
		name: "straw",
		style: "straw"
	},
	4: {
		srm: [4, 5],
		name: "<NAME>",
		style: "paleGold"
	},
	6: {
		srm: [6, 7, 8],
		name: "<NAME>",
		style: "deepGold"
	},
	9: {
		srm: [9, 10, 11],
		name: "<NAME>",
		style: "paleAmber"
	},
	12: {
		srm: [12, 13, 14],
		name: "<NAME>",
		style: "mediumAmber"
	},
	15: {
		srm: [15, 16, 17],
		name: "<NAME>",
		style: "deepAmber"
	},
	18: {
		srm: [18, 19],
		name: "<NAME>",
		style: "amberBrown"
	},
	20: {
		srm: [20, 21, 22, 23],
		name: "Brown",
		style: "brown"
	},
	24: {
		srm: [24, 25, 26, 27, 28, 29],
		name: "<NAME>",
		style: "rubyBrown"
	},
	30: {
		srm: [30, 31, 32, 33, 34, 35, 36, 37, 38, 39],
		name: "<NAME>",
		style: "deepBrown"
	},
	40: {
		srm: [40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90],
		name: "Black",
		style: "black"
	}
};




// SEARCH FUNCTION

function search() {
	// clear results first
	$("#textContainer").html("");
	$("#buttons").html("");


	//get data from form
	q = $("#query").val();

	//Get Request FROM API

	// === this is the digital ocean URI pointer ===
	// var url = "http://138.68.49.141:3000/beers";

	// ==== this is the local host version ====
	var url = "http://localhost:3000/beers";


	var beerData = {
		q:q
	};

	var success = function(data) {
		beerList = data.data;
	// Log data
		console.log(data);

		$.each(beerList, function(i, item) {

			if(item.nameDisplay) {
                    // Get output
				var output = getOutput(item);

                    // Display results
				$("#textContainer").append(output);
			}

		});

             //var buttons = getButtons(prePageToken, nextPageToken);

             // Display buttons
             //$("#buttons").append(buttons);

	};
	$.get(url,beerData,success);

}



// Get Beer data
function loadBeer(beerId) {

        // Using localhost:3000 express server
	var url = "http://api.brewerydb.com/v2/search?q=fat tire&type=beer&key=758086eed7b9e97ad41b21d18b37b4a7";
}

function getOutput(item) {
	var beerID = item.id;
	var beerName = item.nameDisplay;
	var beerDescription = item.description ? item.description : "";
	var beerAbv = item.abv ? item.abv : "UNKNOWN";
	var beerIbu = item.ibu ? item.ibu : "UNKNOWN";
	var beerStyle = item.style ? item.style.category.name : "UNKNOWN";
	var beerPicIcon = item.labels ? item.labels.icon : "http://beerzap.s3.amazonaws.com/beer_no_image_64x64.png";

	var result = $(".templates > .search-result").clone();
	result.data("id", beerID);

	var image = result.find(".beerImage");

	var a = $("<a>", {class:"beerImg"});

	var img = $("<img>", {src:beerPicIcon});
	a.append(img);
	image.append(a);

	var name = result.find(".beerName");
	var beerNameDisplay = $("<h4>", {class:"beerName", text:beerName});

	var readmore = beerDescription.length > 50;

	beerDescription = beerDescription.length < 50
            ? beerDescription
            : beerDescription.substr(0, 60) + "...";

	var description = $("<div>", {class:"beerDescription", html:beerDescription});
	name.append(beerNameDisplay);
	name.append(description);

	var wrapper = $("<div>", {class:"search-result-wrapper"});
	wrapper.append(result);


	if(readmore){
		var readlink = $("<a>", {class:"readMore", text:"Read More"});
		readlink.data("id", beerID);
		wrapper.append(readlink);
	}

	return wrapper;<commit_msg>small change<commit_after>require("../styles/main.styl");
var $ = require("jquery");
var documents = require("./documents");


var beerList =[];
var selectedBeer = null;
var userChoices = {
	color:null,
	bitterness:null,
	alcohol:null,
	hoppyness:null
};
var colors = {
	2: {
		srm: [1, 2],
		name: "<NAME>",
		style: "paleStraw"
	},
	3: {
		srm: [3],
		name: "straw",
		style: "straw"
	},
	4: {
		srm: [4, 5],
		name: "<NAME>",
		style: "paleGold"
	},
	6: {
		srm: [6, 7, 8],
		name: "<NAME>",
		style: "deepGold"
	},
	9: {
		srm: [9, 10, 11],
		name: "<NAME>",
		style: "paleAmber"
	},
	12: {
		srm: [12, 13, 14],
		name: "<NAME>",
		style: "mediumAmber"
	},
	15: {
		srm: [15, 16, 17],
		name: "<NAME>",
		style: "deepAmber"
	},
	18: {
		srm: [18, 19],
		name: "<NAME>",
		style: "amberBrown"
	},
	20: {
		srm: [20, 21, 22, 23],
		name: "Brown",
		style: "brown"
	},
	24: {
		srm: [24, 25, 26, 27, 28, 29],
		name: "<NAME>",
		style: "rubyBrown"
	},
	30: {
		srm: [30, 31, 32, 33, 34, 35, 36, 37, 38, 39],
		name: "<NAME>",
		style: "deepBrown"
	},
	40: {
		srm: [40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90],
		name: "Black",
		style: "black"
	}
};




// SEARCH FUNCTION

function search() {
	// clear results first
	$("#textContainer").html("");
	$("#buttons").html("");


	//get data from form
	q = $("#query").val();

	//Get Request FROM API

	// === this is the digital ocean URI pointer ===
	// var url = "http://192.168.3.11:3000/beers";

	// ==== this is the local host version ====
	var url = "http://localhost:3000/beers";


	var beerData = {
		q:q
	};

	var success = function(data) {
		beerList = data.data;
	// Log data
		console.log(data);

		$.each(beerList, function(i, item) {

			if(item.nameDisplay) {
                    // Get output
				var output = getOutput(item);

                    // Display results
				$("#textContainer").append(output);
			}

		});

             //var buttons = getButtons(prePageToken, nextPageToken);

             // Display buttons
             //$("#buttons").append(buttons);

	};
	$.get(url,beerData,success);

}



// Get Beer data
function loadBeer(beerId) {

        // Using localhost:3000 express server
	var url = "http://api.brewerydb.com/v2/search?q=fat tire&type=beer&key=758086eed7b9e97ad41b21d18b37b4a7";
}

function getOutput(item) {
	var beerID = item.id;
	var beerName = item.nameDisplay;
	var beerDescription = item.description ? item.description : "";
	var beerAbv = item.abv ? item.abv : "UNKNOWN";
	var beerIbu = item.ibu ? item.ibu : "UNKNOWN";
	var beerStyle = item.style ? item.style.category.name : "UNKNOWN";
	var beerPicIcon = item.labels ? item.labels.icon : "http://beerzap.s3.amazonaws.com/beer_no_image_64x64.png";

	var result = $(".templates > .search-result").clone();
	result.data("id", beerID);

	var image = result.find(".beerImage");

	var a = $("<a>", {class:"beerImg"});

	var img = $("<img>", {src:beerPicIcon});
	a.append(img);
	image.append(a);

	var name = result.find(".beerName");
	var beerNameDisplay = $("<h4>", {class:"beerName", text:beerName});

	var readmore = beerDescription.length > 50;

	beerDescription = beerDescription.length < 50
            ? beerDescription
            : beerDescription.substr(0, 60) + "...";

	var description = $("<div>", {class:"beerDescription", html:beerDescription});
	name.append(beerNameDisplay);
	name.append(description);

	var wrapper = $("<div>", {class:"search-result-wrapper"});
	wrapper.append(result);


	if(readmore){
		var readlink = $("<a>", {class:"readMore", text:"More"});
		readlink.data("id", beerID);
		wrapper.append(readlink);
		
	}

	return wrapper;
{'fraction_non_alphanumeric': 0.2042384105960265, 'fraction_numerical': 0.06503311258278145, 'mean_word_length': 3.2043429844097995, 'pattern_counts': {'":': 0, '<': 35, '<?xml version=': 0, '>': 37, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 36, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3243011', 'n_tokens_mistral': 3489, 'n_tokens_neox': 2900, 'n_words': 711}