Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MySql] Add support for fulltext search with MATCH AGAINST function #1030

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

Angelelz
Copy link
Collaborator

@Angelelz Angelelz commented Aug 12, 2023

This PR aims to complete the implementation started in this PR.

  • Added a new fulltextIndex function for the creation of fulltext index.
  • Added a new match function that returns a class with an against method to be able to use the builder pattern as requested in this comment
  • Added a configuration option to be able to use all the modes of the fulltext search.
  • Added corresponding tests.

The user should now be able to use it as follows:

select()
  .from(users)
  .where(
    match(users.name, users.bio)
      .against("drizzle*", {
        mode: "boolean"
      }));

Please note that the fulltextIndex function would address #1018 but won't do anything on it's own as it needs to be supported by Drizzle-kit when creating a migration.

Added a new `fulltextIndex` function and a new configuration `fulltext` for Drizzle-kit to pick up (Needs to be implemented in Drizzle-kit).
Implemented a `match` function that returns a class with an `against` method for fulltext match-against support
@AndriiSherman
Copy link
Member

I will add drizzle-kit support for that and then merge this PR. Will keep you updated here

@Angelelz Angelelz deleted the branch drizzle-team:main August 24, 2023 00:29
@Angelelz Angelelz closed this Aug 24, 2023
@Angelelz Angelelz deleted the main branch August 24, 2023 00:29
@Angelelz Angelelz restored the main branch August 24, 2023 00:30
@Angelelz Angelelz reopened this Aug 24, 2023
@Angelelz Angelelz deleted the branch drizzle-team:main August 24, 2023 00:47
@Angelelz Angelelz closed this Aug 24, 2023
@Angelelz Angelelz deleted the main branch August 24, 2023 00:47
@Angelelz Angelelz restored the main branch August 24, 2023 00:48
@Angelelz Angelelz reopened this Aug 24, 2023
@Angelelz
Copy link
Collaborator Author

I was trying to change the base branch for this PR but it's apparently not possible

@iSchoen
Copy link

iSchoen commented Sep 8, 2023

Would love to see this merged!

@frozenBranch
Copy link

Hi, anyone knows what's the status on this PR? Would love to use this feature on a planetscale db

@anatolzak
Copy link

Are there plans on merging this pull request?

@dane-stevens
Copy link

Any updates on this? Currently having to use planetscale branching, and manually adding fulltext indexes through the planetscale console on every schema change that get's merged to production.

@Baterka
Copy link

Baterka commented Jan 29, 2024

Sadly this is a gamebreaker for me and I will need to move to different orm until this is merged...

@nowlena
Copy link

nowlena commented Feb 8, 2024

I'd also love to see this update merged.

@richardhristov
Copy link

@AndriiSherman has support for this landed in drizzle-kit? You don't accept pull requests in your drizzle-kit-mirror repository right?

@ThisIsRuddy
Copy link

Any news?

@moiguitarrock
Copy link

plan anytime soon to merge this PR? I'd love to use this feature :)

@pedro757
Copy link

pedro757 commented Nov 29, 2024

How about this ? @Angelelz

select()
  .from(users)
  .where(
    match(users.name, users.bio)
-      .against("drizzle*", {
-        mode: "boolean"
-      }));
+     .against("drizzle*", "boolean")
+ );

That would be closer to SQL syntax.

Maybe the variable naming should be more like in MySQL for example inBooleanMode.

select()
  .from(users)
  .where(
    match(users.name, users.bio)
-      .against("drizzle*", {
-        mode: "boolean"
-      }));
+     .against("drizzle*", "inBooleanMode")
+ );

or

select()
  .from(users)
  .where(
    match(users.name, users.bio)
-      .against("drizzle*", {
-        mode: "boolean"
-      }));
+     .against("drizzle*", "booleanMode")
+ );

@johaven
Copy link

johaven commented Dec 24, 2024

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.