diff --git a/docker-compose.yml b/docker-compose.yml index 325ab18..2433eb7 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -15,3 +15,9 @@ services: image: getmeili/meilisearch:v1.5 volumes: - ./melli_data:/meili_data + melli_init: + build: . + command: ["npm", "run", "melli-init"] + volumes: + - ./data/app.db:/app/prisma/dev.db + profiles: ["mellisearch_init"] diff --git a/package.json b/package.json index ee029d4..9710ee3 100644 --- a/package.json +++ b/package.json @@ -17,6 +17,7 @@ "start": "remix-serve ./build/server/index.js", "typecheck": "tsc", "bridge": "bun run scripts/bridge.mts", + "melli-init": "bun run scripts/melli-init.mts", "postinstall": "patch-package" }, "dependencies": { diff --git a/scripts/melli-init.mts b/scripts/melli-init.mts new file mode 100644 index 0000000..a070ec2 --- /dev/null +++ b/scripts/melli-init.mts @@ -0,0 +1,7 @@ +import search from "../app/lib/search"; + +await search.createIndex("articles", { primaryKey: "id" }); + +const index = search.index("articles"); + +await index.updateFilterableAttributes(["site", "createdTimestamp"]);