Commit 84b8eb80 authored by Pallav Agarwal's avatar Pallav Agarwal

Search priority according to tag cloud

parent ec4557b9
......@@ -39,9 +39,7 @@
results = [];
for (i = j = 0, ref = arr.length - 1; 0 <= ref ? j <= ref : j >= ref; i = 0 <= ref ? ++j : --j) {
im2 = $(arr[i]);
console.log(im2);
results.push(im2.on("click", function() {
console.log(this);
$('#imagepreview').attr('src', $(this).attr('src'));
return $('#imagemodal').modal('show');
}));
......
......@@ -13,7 +13,7 @@
};
searchInit = function() {
var div, i, item, j, k, l, len, len1, len2, obj, pairs, posts, ref, searchText, title, txt, word;
var div, i, item, j, k, l, len, len1, len2, len3, m, obj, pairs, posts, ref, searchText, tag, tags, title, txt, word;
posts = $('.post');
obj = (function() {
var i, len, results;
......@@ -32,19 +32,35 @@
for (i = 0, len = obj.length; i < len; i++) {
pairs = obj[i];
title = $(pairs.item).children('.shead').text();
txt = $(pairs.item).text();
txt = $(pairs.item).children('.excerpt').text();
tags = (function() {
var j, len1, ref1, results;
ref1 = $(pairs.item).children('.tags').text().split(',');
results = [];
for (j = 0, len1 = ref1.length; j < len1; j++) {
k = ref1[j];
if (k.indexOf(':') > -1) {
results.push([k.split(':')[0].trim(), +k.split(':')[1]]);
}
}
return results;
})();
for (j = 0, len1 = searchText.length; j < len1; j++) {
word = searchText[j];
if (word.length > 0) {
pairs.score += 2 * title.count(word) + 1 * txt.count(word);
for (l = 0, len2 = tags.length; l < len2; l++) {
tag = tags[l];
pairs.score += tag[1] * tag[0].count(word);
}
}
}
}
obj = (function() {
var l, len2, results;
var len3, m, results;
results = [];
for (l = 0, len2 = obj.length; l < len2; l++) {
k = obj[l];
for (m = 0, len3 = obj.length; m < len3; m++) {
k = obj[m];
if (k.score !== 0) {
results.push(k);
}
......@@ -55,14 +71,13 @@
return b.score - a.score;
});
$('#content-holder').html('');
for (l = 0, len2 = obj.length; l < len2; l++) {
div = obj[l];
for (m = 0, len3 = obj.length; m < len3; m++) {
div = obj[m];
$('#content-holder').append(div.item);
}
if (obj.length === 0) {
$('#content-holder').append('Sorry, no search results found.');
return $('#content-holder').append('Sorry, no search results found.');
}
return console.log(obj);
};
$(searchInit);
......
......@@ -72,15 +72,15 @@
Package Management without root access - An intro to LinuxBrew
</a>
<br />
First a little background. At my college, we are given login accounts for accessing PC's at the Computer Labs. I usually use them for setting up my work environment for easy access through SSH. Though that makes it very easy for me to resume my work, from any computer or...
<div class="excerpt">
First a little background. At my college, we are given login accounts for accessing PC's at the Computer Labs. I usually use them for setting.......a very actively developed project and chances are, by the time you are reading this, it would be as perfect as other linux package managers.
</div>
<br />
<div class='tags'>
package:9, brew:6, directory:4, manager:3, linux:3, home directory:3, home:3, export:3, bashrc:3, LinuxBrew:3, HOME:3, work environment:1, system doesn:1, python brew:1, preinstalled packages:1, package manager:1, need root access:1, login accounts:1, linuxbrew folder:1, linux package managers:1, installs packages:1, installation page:1, export PATH HOME export MANPATH HOME export INFOPATH HOME:1, clone https github linuxbrew:1, brew doctor:1, accessing PC:1, Mac OS X HomeBrew package manager:1, First paste:1, Computer Labs:1,
</div>
<br /><br />
</div>
<div class="post">
......@@ -88,19 +88,18 @@
IIT Kanpur: The First Year
</a>
<br />
First of all, I think congratulations are in order. If you are reading this, you have probably cracked one of the toughest exams in the world. After two years of hard work and challenges, you have finally succeeded! You have made it to one of the world's finest engineering colleges,...
<div class="excerpt">
First of all, I think congratulations are in order. If you are reading this, you have probably cracked one of the toughest exams in the.......hope to see you at IIT. Also consider looking at the following resources: Collection of Articles about IITK #thatsIITK Our Professor's Guide to JEE Counselling
</div>
<br />
<div class='tags'>
year:17, IIT:15, campus:12, student:11, Kanpur:11, IITK:10, IIT Kanpur:9, decision:6, rank:5, college:5, part:4, branch:4, time:3, thing:3, team:3, reading:3, hostel:3, home:3, group:3, fresher:3, fact:3, download:3, doesn:3, city:3, Guide:3, Student Guide:2, IIT Bombay:2, winner team:1, student bodies:1, science wizard:1, return home:1, pallavagarwal 07:1, need guidance:1, metro cities:1, linux logs:1, housing teachers:1, hostel timings:1, hostel rules:1, hobby groups:1, engineering colleges:1, dada:1, computer games:1, coaching teachers:1, clothes haven:1, chachu:1, campus community:1, branch change:1, baapu:1, art courts:1, Year students:1, Wind Tunnel:1, Unmanned Aerial Vehicles:1, Total amount:1, Saksham Sharma:1, SG baapu:1, Pallav Agarwal:1, LAN ban:1, Kunal Kapila:1, Kanpur city:1, JEE Advanced:1, Indian Institutes:1, IIT Delhi:1, HD movie download:1, Full disclosure:1, Download limits:1, DC LAN:1, Branch doesn:1, BS Maths branch:1, Autonomous Underwater Vehicle UAV:1, Automotive Engineers AUV:1, Academic Mentor:1, 5 students:1, 5 6 students:1, 4 members:1, 20 MBps:1, 2 minutes:1, 1055 acres:1, 100 GB:1,
</div>
<br /><br />
</div>
</div>
</div>
</div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment