Skip to content

Commit

Permalink
Merge pull request #6 from lshap/master
Browse files Browse the repository at this point in the history
Updating to Lauren's latest
  • Loading branch information
dhartunian committed May 16, 2016
2 parents 972b0e9 + 5a5b7a9 commit 037162f
Show file tree
Hide file tree
Showing 9 changed files with 19,084 additions and 729 deletions.
4 changes: 4 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ App.get('/locations', function(request, response) {
SL.getLocationsByAddress(address, function(err, data) {
returnJSON(response, err, data);
});
} else {
SL.getLocations("", function(err, data) {
returnJSON(response, err, data);
});
}
});

Expand Down
12 changes: 11 additions & 1 deletion lib/db.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ module.exports = function(Config) {

module.getLocations = function(queryStr, callback) {
var queryLower = queryStr.toLowerCase();
var query = "SELECT * FROM locations WHERE LOWER(name) LIKE '%{{query_str}}%'";
var query = "SELECT l.* FROM locations l LEFT JOIN locations_offerings lo on l.cartodb_id = lo.location_id LEFT JOIN offerings o on"
+ " o.cartodb_id = lo.offering_id WHERE LOWER(l.name) LIKE '%{{query_str}}%' OR LOWER(o.name) like '%{{query_str}}%'"
+ " OR LOWER(l.description) LIKE '%{{query_str}}%'";

var options = {'query_str': queryLower};
this._query(query, options, callback);
};
Expand All @@ -34,6 +37,13 @@ module.exports = function(Config) {
this._query(query, options, callback);
};

module.semanticSearch = function(queryStr, callback) {
var queryLower = queryStr.toLowerCase();
var query = "SELECT * FROM locations WHERE LOWER(name) LIKE '%{{query_str}}%'";
var options = {'query_str': queryLower};
this._query(query, options, callback);
};

module.getComments = function(location_id, callback) {
var query = 'SELECT * FROM {{table}} WHERE (comment = \'\') IS FALSE AND location_id = {{id}} ORDER BY created_at DESC';
var options = { table: 'comments', id: location_id };
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,13 @@
"express": "~4.9.x",
"express-session": "1.0.4",
"html": "latest",
"lodash": "^4.12.0",
"method-override": "1.0.0",
"morgan": "1.0.0",
"react": "^0.14.7",
"react-dom": "^0.14.7",
"react-router": "^2.4.0",
"react-typeahead": "^2.0.0-alpha.1",
"redis": "^0.12.1",
"request": "latest",
"swig": "~1.3.2",
Expand Down
2 changes: 1 addition & 1 deletion public/streetlives.css
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@
z-index: 10; }

@media screen and (max-width: 470px) {
.SearchField {
.Map .SearchField {
width: 80%;
left: 0;
margin-left: 10%; } }
Expand Down
Loading

0 comments on commit 037162f

Please sign in to comment.