mirror of
https://github.com/mempool/mempool.git
synced 2025-02-24 14:50:52 +01:00
Add simon's comment to $searchNodeByPublicKeyOrAlias()
This commit is contained in:
parent
03be3ab561
commit
10bfb51215
1 changed files with 1 additions and 0 deletions
|
@ -368,6 +368,7 @@ class NodesApi {
|
|||
.split(' ')
|
||||
.filter(key => key.length)
|
||||
.map((search) => '+' + search + '*').join(' ');
|
||||
// %keyword% is wildcard search and can't be indexed so it's slower as the node database grow. keyword% can be indexed but then you can't search for "Nicehash" and get result for ln.nicehash.com. So we use fulltext index for words "ln, nicehash, com" and nicehash* will find it instantly.
|
||||
const query = `SELECT public_key, alias, capacity, channels, status FROM nodes WHERE public_key LIKE ? OR MATCH alias_search AGAINST (? IN BOOLEAN MODE) ORDER BY capacity DESC LIMIT 10`;
|
||||
const [rows]: any = await DB.query(query, [publicKeySearch, aliasSearch]);
|
||||
return rows;
|
||||
|
|
Loading…
Add table
Reference in a new issue