mirror of
https://github.com/koreanbots/core.git
synced 2025-12-15 14:10:22 +00:00
parent
50b435ef52
commit
ada3d928a0
@ -244,8 +244,8 @@ async function getBotList(type: ListType, page = 1, query?: string):Promise<List
|
|||||||
.select(['id'])
|
.select(['id'])
|
||||||
} else if (type === 'SEARCH') {
|
} else if (type === 'SEARCH') {
|
||||||
if (!query) throw new Error('쿼리가 누락되었습니다.')
|
if (!query) throw new Error('쿼리가 누락되었습니다.')
|
||||||
count = (await knex.raw('SELECT count(*) FROM bots WHERE MATCH(`name`, `intro`, `desc`) AGAINST(? in boolean mode)', [decodeURI(query)]))[0][0]['count(*)']
|
count = (await knex.raw('SELECT count(*) FROM bots WHERE MATCH(`name`, `intro`, `desc`) AGAINST(? in boolean mode)', [decodeURI(query) + '*']))[0][0]['count(*)']
|
||||||
res = (await knex.raw('SELECT id, votes, MATCH(`name`, `intro`, `desc`) AGAINST(? in boolean mode) as relevance FROM bots WHERE MATCH(`name`, `intro`, `desc`) AGAINST(? in boolean mode) ORDER BY relevance DESC, votes DESC LIMIT 16 OFFSET ?', [decodeURI(query), decodeURI(query), ((page ? Number(page) : 1) - 1) * 16]))[0]
|
res = (await knex.raw('SELECT id, votes, MATCH(`name`, `intro`, `desc`) AGAINST(? in boolean mode) as relevance FROM bots WHERE MATCH(`name`, `intro`, `desc`) AGAINST(? in boolean mode) ORDER BY relevance DESC, votes DESC LIMIT 16 OFFSET ?', [decodeURI(query) + '*', decodeURI(query) + '*', ((page ? Number(page) : 1) - 1) * 16]))[0]
|
||||||
} else {
|
} else {
|
||||||
count = 1
|
count = 1
|
||||||
res = []
|
res = []
|
||||||
@ -322,8 +322,8 @@ async function getServerList(type: ListType, page = 1, query?: string):Promise<L
|
|||||||
.select(['id'])
|
.select(['id'])
|
||||||
} else if (type === 'SEARCH') {
|
} else if (type === 'SEARCH') {
|
||||||
if (!query) throw new Error('쿼리가 누락되었습니다.')
|
if (!query) throw new Error('쿼리가 누락되었습니다.')
|
||||||
count = (await knex.raw('SELECT count(*) FROM servers WHERE MATCH(`name`, `intro`, `desc`) AGAINST(? in boolean mode)', [decodeURI(query)]))[0][0]['count(*)']
|
count = (await knex.raw('SELECT count(*) FROM servers WHERE MATCH(`name`, `intro`, `desc`) AGAINST(? in boolean mode)', [decodeURI(query) + '*']))[0][0]['count(*)']
|
||||||
res = (await knex.raw('SELECT id, votes, MATCH(`name`, `intro`, `desc`) AGAINST(? in boolean mode) as relevance FROM servers WHERE MATCH(`name`, `intro`, `desc`) AGAINST(? in boolean mode) ORDER BY relevance DESC, votes DESC LIMIT 16 OFFSET ?', [decodeURI(query), decodeURI(query), ((page ? Number(page) : 1) - 1) * 16]))[0]
|
res = (await knex.raw('SELECT id, votes, MATCH(`name`, `intro`, `desc`) AGAINST(? in boolean mode) as relevance FROM servers WHERE MATCH(`name`, `intro`, `desc`) AGAINST(? in boolean mode) ORDER BY relevance DESC, votes DESC LIMIT 16 OFFSET ?', [decodeURI(query) + '*', decodeURI(query) + '*', ((page ? Number(page) : 1) - 1) * 16]))[0]
|
||||||
} else {
|
} else {
|
||||||
count = 1
|
count = 1
|
||||||
res = []
|
res = []
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user