order by score @ tagsuggest

This commit is contained in:
Flummi 2022-03-29 14:33:43 +02:00
parent c7c5b983c6
commit 982ddce087
2 changed files with 4 additions and 3 deletions

View File

@ -177,7 +177,7 @@ const flash = ({ type, msg }) => {
option.value = entry.tag; option.value = entry.tag;
if(!/fox/.test(navigator.userAgent)) if(!/fox/.test(navigator.userAgent))
option.innerText = `tagged ${entry.tagged} times`; option.innerText = `tagged ${entry.tagged} times (score: ${entry.score.toFixed(2)})`;
testList.insertAdjacentElement('beforeEnd', option); testList.insertAdjacentElement('beforeEnd', option);
}; };
@ -351,7 +351,7 @@ const flash = ({ type, msg }) => {
if(document.location.pathname === '/settings') { if(document.location.pathname === '/settings') {
const saveAvatar = async e => { const saveAvatar = async e => {
e.preventDefault(); e.preventDefault();
const avatar = +document.querySelector('input[name="i_avatar"]').value; const avatar = +document.querySelector('input[name="i_avatar"]').value;
let res = await fetch('/api/v2/settings/setAvatar', { let res = await fetch('/api/v2/settings/setAvatar', {
method: 'PUT', method: 'PUT',

View File

@ -1,5 +1,6 @@
import sql from '../../sql.mjs'; import sql from '../../sql.mjs';
import lib from '../../lib.mjs'; import lib from '../../lib.mjs';
import search from '../../routeinc/search.mjs';
const allowedMimes = [ "audio", "image", "video", "%" ]; const allowedMimes = [ "audio", "image", "video", "%" ];
export default router => { export default router => {
@ -154,7 +155,7 @@ export default router => {
.orderBy('tagged', 'desc') .orderBy('tagged', 'desc')
.limit(15); .limit(15);
reply.success = true; reply.success = true;
reply.suggestions = q; reply.suggestions = search(q, searchString);
} catch(err) { } catch(err) {
reply.error = err.msg; reply.error = err.msg;
} }