mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-04-24 21:13:35 -04:00
Check if searching for an id
This commit is contained in:
parent
96f201dae4
commit
a9b58144c4
1 changed files with 7 additions and 2 deletions
|
@ -718,8 +718,13 @@ UserHandler = class UserHandler extends Handler
|
|||
host: config.sphinxServer
|
||||
port: 9306
|
||||
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) =>
|
||||
return @sendDatabaseError res, err if err
|
||||
ids = rows.map (r) -> r.mongoid
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue