Adding latitude and longitude into review data
This commit is contained in:
parent
b0ed245096
commit
6f5d9ca6bf
12
db/hscd.sql
12
db/hscd.sql
File diff suppressed because one or more lines are too long
@ -15,17 +15,19 @@ var conn = mysql.createConnection({
|
||||
//
|
||||
|
||||
conn.query('DROP TABLE IF EXISTS reviews');
|
||||
conn.query('CREATE TABLE reviews(name VARCHAR(100) NOT NULL, url VARCHAR(200) NOT NULL, food FLOAT NOT NULL, service FLOAT NOT NULL, value FLOAT NOT NULL, atmosphere FLOAT NOT NULL, id INT NOT NULL AUTO_INCREMENT PRIMARY KEY)');
|
||||
conn.query('CREATE TABLE reviews(name VARCHAR(100) NOT NULL, url VARCHAR(200) NOT NULL, food FLOAT NOT NULL, service FLOAT NOT NULL, value FLOAT NOT NULL, atmosphere FLOAT NOT NULL, latitude FLOAT NOT NULL, longitude FLOAT NOT NULL, id INT NOT NULL AUTO_INCREMENT PRIMARY KEY)');
|
||||
|
||||
for (var i = 0, count = data.length; i < count; ++i) {
|
||||
var record = data[i];
|
||||
conn.query('INSERT INTO reviews(name, url, food, service, value, atmosphere) VALUES(?, ?, ?, ?, ?, ?)', [
|
||||
conn.query('INSERT INTO reviews(name, url, food, service, value, atmosphere, latitude, longitude) VALUES(?, ?, ?, ?, ?, ?, ?, ?)', [
|
||||
record.name,
|
||||
record.relativeUrl,
|
||||
record.rating.food,
|
||||
record.rating.service,
|
||||
record.rating.value,
|
||||
record.rating.atmosphere
|
||||
record.rating.atmosphere,
|
||||
record.geo.latitude,
|
||||
record.geo.longitude
|
||||
]);
|
||||
}
|
||||
|
||||
@ -38,10 +40,10 @@ conn.query('DROP TABLE IF EXISTS keywords');
|
||||
conn.query('CREATE TABLE keywords(name VARCHAR(50) NOT NULL, food FLOAT NOT NULL, service FLOAT NOT NULL, value FLOAT NOT NULL, atmosphere FLOAT NOT NULL, PRIMARY KEY(name))');
|
||||
|
||||
var keywords = {
|
||||
'delicious': [1.0, 0.0, 0.0, 0.0],
|
||||
'accommodating': [0.0, 1.0, 0.0, 0.0],
|
||||
'well-priced': [0.0, 0.0, 1.0, 0.0],
|
||||
'atmospheric': [0.0, 0.0, 0.0, 1.0]
|
||||
delicious: [1.0, 0.0, 0.0, 0.0],
|
||||
accommodating: [0.0, 1.0, 0.0, 0.0],
|
||||
affordable: [0.0, 0.0, 1.0, 0.0],
|
||||
atmospheric: [0.0, 0.0, 0.0, 1.0]
|
||||
};
|
||||
|
||||
for (var keyword in keywords) {
|
||||
|
Loading…
Reference in New Issue
Block a user