mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-30 10:56:53 -05:00
Check if searching for an id
This commit is contained in:
parent
61bf5824ac
commit
6e2e3d5cb7
1 changed files with 7 additions and 2 deletions
|
@ -718,8 +718,13 @@ UserHandler = class UserHandler extends Handler
|
||||||
host: config.sphinxServer
|
host: config.sphinxServer
|
||||||
port: 9306
|
port: 9306
|
||||||
connection.connect()
|
connection.connect()
|
||||||
q = req.body.search;
|
|
||||||
mysqlq = "SELECT *, WEIGHT() as skey FROM user WHERE MATCH(?);"
|
q = req.body.search
|
||||||
|
if isID q
|
||||||
|
mysqlq = "SELECT *, WEIGHT() as skey FROM user WHERE mongoid = ? LIMIT 100;"
|
||||||
|
else
|
||||||
|
mysqlq = "SELECT *, WEIGHT() as skey FROM user WHERE MATCH(?) LIMIT 100;"
|
||||||
|
|
||||||
connection.query mysqlq, [q], (err, rows, fields) =>
|
connection.query mysqlq, [q], (err, rows, fields) =>
|
||||||
return @sendDatabaseError res, err if err
|
return @sendDatabaseError res, err if err
|
||||||
ids = rows.map (r) -> r.mongoid
|
ids = rows.map (r) -> r.mongoid
|
||||||
|
|
Loading…
Reference in a new issue