Is FULLTEXT Search Possible in MySQL via FULLTEXT Index?
Hello everyone,
I am currently working on a project using Drizzle ORM with a MySQL database, and I'm looking to implement full-text search capabilities. While I am aware that MySQL supports FULLTEXT indexes (as detailed in their documentation: https://dev.mysql.com/doc/refman/8.0/en/fulltext-natural-language.html), I am uncertain about the integration of these features with Drizzle ORM.
My questions are as follows:
1. Does Drizzle ORM support the creation of FULLTEXT indexes in line with MySQL's native capabilities? How can I define a FULLTEXT index on a column in my entity model using Drizzle ORM?
2. If Drizzle ORM does not directly support FULLTEXT indexes, what are the recommended best practices or workarounds for implementing full-text search functionality with MySQL in a Drizzle ORM setup?
Any insights, code examples, or references to documentation would be immensely helpful. Additionally, I'm open to suggestions for alternative methods within the Drizzle ORM and MySQL framework if direct support for FULLTEXT indexes is not available.
Thank you for your assistance!
4 Replies
1. Drizzle currently does not have support for fulltext index in drizzle-kit, meaning, it won't write the migrations for you. There is an open PR for support of this on drizzle-orm but not merged yet.
2. I have fulltext search working properly in my app, you just need to create the indexes manually in the database, either via
db.execute
, on ssh or in your console.
To use it, you'll need to use the sql operator and write your query that wayThank you!
Is this still not supported?
If not, how can I best automate the index creation. Is this possible from my schema definition so that it is created on db push/migrate or would I have to create some other script.
I have the same question ☝️