Fix wrong parameter ordering

This commit is contained in:
PrivateGER 2023-05-25 02:19:42 +02:00 committed by PrivateGER
parent 7c0509b2f5
commit 4f07c88abb
3 changed files with 11 additions and 11 deletions

View File

@ -17,8 +17,8 @@ const port = hasConfig ? config.meilisearch.port ?? 7700 : 0;
const auth = hasConfig ? config.meilisearch.apiKey ?? "" : "";
const client = new MeiliSearch({
host: 'http://127.0.0.1:7700',
apiKey: 'masterKey',
host: `http://${host}:${port}`,
apiKey: auth,
})
const posts = client.index('posts');
@ -39,6 +39,8 @@ export type MeilisearchNote = {
export default hasConfig ? {
search: (query : string, limit : number, offset : number) => {
logger.info(`Searching for ${query}`);
logger.info(`Limit: ${limit}`);
logger.info(`Offset: ${offset}`);
return posts.search(query, {
limit: limit,

View File

@ -179,7 +179,7 @@ export default define(meta, paramDef, async (ps, me) => {
// Use meilisearch to fetch and step through all search results that could match the requirements
const ids = [];
while (true) {
const results = await meilisearch.search(ps.query, start, chunkSize);
const results = await meilisearch.search(ps.query, chunkSize, start);
start += chunkSize;
@ -188,19 +188,17 @@ export default define(meta, paramDef, async (ps, me) => {
}
const res = results.hits
.filter((key) => {
let note = key as MeilisearchNote;
if (ps.userId && note.userId !== ps.userId) {
.filter((key: MeilisearchNote) => {
if (ps.userId && key.userId !== ps.userId) {
return false;
}
if (ps.channelId && note.channelId !== ps.channelId) {
if (ps.channelId && key.channelId !== ps.channelId) {
return false;
}
if (ps.sinceId && note.id <= ps.sinceId) {
if (ps.sinceId && key.id <= ps.sinceId) {
return false;
}
if (ps.untilId && note.id >= ps.untilId) {
if (ps.untilId && key.id >= ps.untilId) {
return false;
}
return true;

View File

@ -67,7 +67,7 @@ import type { UserProfile } from "@/models/entities/user-profile.js";
import { db } from "@/db/postgre.js";
import { getActiveWebhooks } from "@/misc/webhook-cache.js";
import { shouldSilenceInstance } from "@/misc/should-block-instance.js";
import meilisearch from "@/db/meilisearch";
import meilisearch from "../../db/meilisearch.js";
const mutedWordsCache = new Cache<
{ userId: UserProfile["userId"]; mutedWords: UserProfile["mutedWords"] }[]