Adding proximity feature
This commit is contained in:
parent
1f5e27a24f
commit
738b97808f
@ -88,7 +88,7 @@
|
||||
var _padding = 10;
|
||||
var _panelSize = 20;
|
||||
var _tickSize = 5;
|
||||
var _width = 125;
|
||||
var _width = 110;
|
||||
var _easeTime = 400;
|
||||
|
||||
var _animation = null;
|
||||
|
@ -28,6 +28,7 @@ CREATE TABLE `keywords` (
|
||||
`service` float NOT NULL,
|
||||
`value` float NOT NULL,
|
||||
`atmosphere` float NOT NULL,
|
||||
`proximity` float NOT NULL,
|
||||
PRIMARY KEY (`name`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
@ -38,7 +39,7 @@ CREATE TABLE `keywords` (
|
||||
|
||||
LOCK TABLES `keywords` WRITE;
|
||||
/*!40000 ALTER TABLE `keywords` DISABLE KEYS */;
|
||||
INSERT INTO `keywords` VALUES ('accommodating',0,1,0,0),('affordable',0,0,1,0),('atmospheric',0,0,0,1),('delicious',1,0,0,0);
|
||||
INSERT INTO `keywords` VALUES ('accommodating',0,1,0,0,0),('affordable',0,0,1,0,0),('atmospheric',0,0,0,1,0),('delicious',1,0,0,0,0);
|
||||
/*!40000 ALTER TABLE `keywords` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
|
||||
@ -105,4 +106,4 @@ UNLOCK TABLES;
|
||||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||
|
||||
-- Dump completed on 2014-11-17 15:15:16
|
||||
-- Dump completed on 2014-11-17 16:48:17
|
||||
|
@ -37,18 +37,18 @@ for (var i = 0, count = data.length; i < count; ++i) {
|
||||
//
|
||||
|
||||
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))');
|
||||
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, proximity 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],
|
||||
affordable: [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, 0.0],
|
||||
accommodating: [0.0, 1.0, 0.0, 0.0, 0.0],
|
||||
affordable: [0.0, 0.0, 1.0, 0.0, 0.0],
|
||||
atmospheric: [0.0, 0.0, 0.0, 1.0, 0.0]
|
||||
};
|
||||
|
||||
for (var keyword in keywords) {
|
||||
var record = keywords[keyword];
|
||||
conn.query('INSERT INTO keywords VALUES(?, ?, ?, ?, ?)', [keyword].concat(record));
|
||||
conn.query('INSERT INTO keywords VALUES(?, ?, ?, ?, ?, ?)', [keyword].concat(record));
|
||||
}
|
||||
|
||||
|
||||
|
@ -152,7 +152,8 @@ function addKeyword(query, callback) {
|
||||
query.features.food,
|
||||
query.features.service,
|
||||
query.features.value,
|
||||
query.features.atmosphere
|
||||
query.features.atmosphere,
|
||||
query.features.proximity
|
||||
];
|
||||
|
||||
pool.query('INSERT INTO keywords VALUES(?, ?, ?, ?, ?)', values, function(err) {
|
||||
@ -183,7 +184,8 @@ function getKeywords(callback) {
|
||||
food: row.food,
|
||||
service: row.service,
|
||||
value: row.value,
|
||||
atmosphere: row.atmosphere
|
||||
atmosphere: row.atmosphere,
|
||||
proximity: row.proximity
|
||||
};
|
||||
}
|
||||
|
||||
@ -232,10 +234,7 @@ function getData(callback) {
|
||||
|
||||
function getParameters(callback) {
|
||||
getKeywords(function(keywords) {
|
||||
callback({
|
||||
keywords: keywords,
|
||||
features: [ 'food', 'service', 'atmosphere', 'value' ]
|
||||
});
|
||||
callback({ keywords: keywords });
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user