Skip to content

Commit

Permalink
Made chart responsive. Added conf script for index set up
Browse files Browse the repository at this point in the history
  • Loading branch information
davidlivingrooms committed Jun 20, 2015
1 parent cb32ee6 commit 5e5e538
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 7 deletions.
4 changes: 4 additions & 0 deletions conf/create_indexes.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
CREATE INDEX article_gin
ON article
USING gin
(title COLLATE pg_catalog."default" gin_trgm_ops);
2 changes: 1 addition & 1 deletion public/js/graph.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ function Graph() {
function articlePromise(title) {
return Promise.resolve(
$.ajax({
url: 'http://localhost:3000/wikimaps/getArticleInfo',
url: 'http://wikigrapher.com/wikimaps/getArticleInfo',
data: {title: title},
dataType: 'json'
}));
Expand Down
5 changes: 2 additions & 3 deletions public/js/wikigraph.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ var cola = require('cola');
var Promise = require('bluebird');
var Graph = require('./graph.js');
var StringUtils = new (require('./string_utils.js'));
var graph;

module.exports = {
initializeNewGraph: function(rootArticle) {
Expand All @@ -29,8 +28,8 @@ function WikiGraph(rootArticle)
.size([width, height]);

var outer = d3.select("#chart").append("svg")
.attr("width", width)
.attr("height", height)
.attr("viewBox", "0 0 " + width + " " + height )
.attr("preserveAspectRatio", "xMinYMin")
.attr("pointer-events", "all");

//Set up tooltip
Expand Down
2 changes: 1 addition & 1 deletion public/js/wikisearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ module.exports = {
},
queryTokenizer: Bloodhound.tokenizers.whitespace,
remote: {
url: 'http://localhost:3000/wikimaps/findArticles?title=%QUERY',
url: 'http://wikigrapher.com/wikimaps/findArticles?title=%QUERY',
filter: function (articles) {
// Map the remote source JSsON array to a JavaScript array
return $.map(articles, function (article) {
Expand Down
2 changes: 0 additions & 2 deletions routes/wikimaps.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,13 @@ router.get('/getArticleInfo', function(req, res) {
var titleStr = req.query.title;

pg.connect(connectionString, function (err, client, done) {
//var query = client.query("SELECT * FROM article WHERE LOWER(title) = LOWER($1)", [titleStr]);
var query = client.query("SELECT * FROM article WHERE title = $1", [titleStr]);
query.on('row', function (row) {
results.push(row);
});

query.on('end', function () {
client.end();
//var unknownThumbnail = 'http://upload.wikimedia.org/wikipedia/commons/3/37/No_person.jpg';
var unknownThumbnail = 'https://upload.wikimedia.org/wikipedia/commons/a/ac/No_image_available.svg';
var links = [];
if (results[0] && results[0].links) {
Expand Down

0 comments on commit 5e5e538

Please sign in to comment.