mirror of
https://iceshrimp.dev/crimekillz/trashposs
synced 2024-11-24 17:59:05 +01:00
formatter
This commit is contained in:
parent
7ef78fcd12
commit
91970a2fc6
@ -18,50 +18,50 @@ const hasConfig =
|
|||||||
config.meilisearch.port ||
|
config.meilisearch.port ||
|
||||||
config.meilisearch.apiKey);
|
config.meilisearch.apiKey);
|
||||||
|
|
||||||
if(hasConfig) {
|
if (hasConfig) {
|
||||||
const host = hasConfig ? config.meilisearch.host ?? "localhost" : "";
|
const host = hasConfig ? config.meilisearch.host ?? "localhost" : "";
|
||||||
const port = hasConfig ? config.meilisearch.port ?? 7700 : 0;
|
const port = hasConfig ? config.meilisearch.port ?? 7700 : 0;
|
||||||
const auth = hasConfig ? config.meilisearch.apiKey ?? "" : "";
|
const auth = hasConfig ? config.meilisearch.apiKey ?? "" : "";
|
||||||
const ssl = hasConfig ? config.meilisearch.ssl ?? false : false;
|
const ssl = hasConfig ? config.meilisearch.ssl ?? false : false;
|
||||||
|
|
||||||
logger.info("Connecting to MeiliSearch");
|
logger.info("Connecting to MeiliSearch");
|
||||||
|
|
||||||
client = new MeiliSearch({
|
client = new MeiliSearch({
|
||||||
host: `${ssl ? "https" : "http"}://${host}:${port}`,
|
host: `${ssl ? "https" : "http"}://${host}:${port}`,
|
||||||
apiKey: auth,
|
apiKey: auth,
|
||||||
});
|
});
|
||||||
|
|
||||||
posts = client.index("posts");
|
posts = client.index("posts");
|
||||||
|
|
||||||
posts
|
posts
|
||||||
.updateSearchableAttributes(["text"])
|
.updateSearchableAttributes(["text"])
|
||||||
.catch((e) =>
|
.catch((e) =>
|
||||||
logger.error(`Setting searchable attr failed, searches won't work: ${e}`),
|
logger.error(`Setting searchable attr failed, searches won't work: ${e}`),
|
||||||
);
|
);
|
||||||
|
|
||||||
posts
|
posts
|
||||||
.updateFilterableAttributes([
|
.updateFilterableAttributes([
|
||||||
"userName",
|
"userName",
|
||||||
"userHost",
|
"userHost",
|
||||||
"mediaAttachment",
|
"mediaAttachment",
|
||||||
"createdAt",
|
"createdAt",
|
||||||
"userId",
|
"userId",
|
||||||
])
|
])
|
||||||
.catch((e) =>
|
.catch((e) =>
|
||||||
logger.error(
|
logger.error(
|
||||||
`Setting filterable attr failed, advanced searches won't work: ${e}`,
|
`Setting filterable attr failed, advanced searches won't work: ${e}`,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
posts
|
posts
|
||||||
.updateSortableAttributes(["createdAt"])
|
.updateSortableAttributes(["createdAt"])
|
||||||
.catch((e) =>
|
.catch((e) =>
|
||||||
logger.error(
|
logger.error(
|
||||||
`Setting sortable attr failed, placeholder searches won't sort properly: ${e}`,
|
`Setting sortable attr failed, placeholder searches won't sort properly: ${e}`,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
logger.info("Connected to MeiliSearch");
|
logger.info("Connected to MeiliSearch");
|
||||||
}
|
}
|
||||||
|
|
||||||
export type MeilisearchNote = {
|
export type MeilisearchNote = {
|
||||||
|
Loading…
Reference in New Issue
Block a user