PrismaP
Prisma12mo ago
7 replies
ididit

creating a BM25 index

I have created a BM25 index by creating a migration file to create it and also added the schema to ignore the index.

model Post {
  id                           Int                                   @id @default(autoincrement())
  name                         String?
  /// @ignored
  /// @schema-ignored-index(post_bm25_idx)
  @@index(fields: [id, name], map: "post_bm25_idx")
}


and here is the custom migration file i created to run:
-- CreateIndex
-- prisma-ignore-index
CREATE INDEX post_bm25_idx ON "Post"
USING bm25 (id, name)
WITH (
    key_field='id',
    text_fields='{
        "name": {"fast": true}
    }'
);


but the next time i run a migration or try to create a new one, it hangs with a message like:
prisma:schemaEngine:stderr {"timestamp":"2025-02-04T01:31:58.231558Z","level":"WARN","fields":{"message":"Unknown index algorithm on post_bm25_idx: bm25"},"target":"sql_schema_describer::postgres","span":{"namespaces":"None","name":"describe_schema"},"spans":[{"name":"DevDiagnostic"},{"namespaces":"None","name":"describe_schema"}]} +0ms


this is blocking me from running or creating new migration file and the database is in a limbo. please help!
Was this page helpful?