0

I'm using XAMPP 8.1.10 on Windows 10 with InnoDB tables, and I'm trying to create a MariaDB table with a FULLTEXT index using the ngram parser to support searching in Chinese, Japanese and Korean languages.

When I try to do it, even using the exact example command from MySQL's own website, it gives this error in PHPMyAdmin:

Error
Static analysis:

1 errors were found during analysis.

A comma or a closing bracket was expected. (near "WITH" at position 158)
SQL query: Copy

CREATE TABLE articles ( id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, title VARCHAR(200), body TEXT, FULLTEXT (title,body) WITH PARSER ngram ) ENGINE=InnoDB CHARACTER SET utf8mb4;

MariaDB said: Documentation

#1128 - Function 'ngram' is not defined

The example command is this:

CREATE TABLE articles (
      id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
      title VARCHAR(200),
      body TEXT,
      FULLTEXT (title,body) WITH PARSER ngram
    ) ENGINE=InnoDB CHARACTER SET utf8mb4;

If I remove the " WITH PARSER ngram" from the FULLTEXT line, it works without errors, but of course isn't going to use the ngram parser. Using the ALTER TABLE command also doesn't work:

ALTER TABLE articles ADD FULLTEXT INDEX ft_index (title,body) WITH PARSER ngram;

giving this error:

Error
Static analysis:

1 errors were found during analysis.

A new statement was found, but no delimiter between it and the previous one. (near "WITH" at position 62)
SQL query: Copy

ALTER TABLE articles ADD FULLTEXT INDEX ft_index (title,body) WITH PARSER ngram;

MariaDB said: Documentation

#1128 - Function 'ngram' is not defined

Is the ngram parser not installed in XAMPP, or am I doing something else wrong?

Edit: Apparently XAMPP uses MariaDB despite it saying MySQL in the XAMPP Control Panel and in the error messages. MariaDB doesn't support the ngram parser yet. Solved by swapping MariaDB for MySQL in XAMPP using this guide https://stackoverflow.com/a/58973750/20394214

  • Run this command in phpmyadmin or the mysql client: `SHOW PLUGINS;`. Do you see a row where name is 'ngram'? – Bill Karwin Nov 30 '22 at 00:42
  • Nope, I guess it isn't installed in XAMPP's build of MySQL, despite the MySQL website mentioning it as a "built-in server plugin". – RocketHog55 Nov 30 '22 at 01:33
  • 1
    What does `SELECT VERSION();` return? I don't use XAMPP, but I recall they bundle MariaDB, not MySQL. These are different products, and you shouldn't expect them to be compatible. – Bill Karwin Nov 30 '22 at 02:37
  • 10.4.25-MariaDB. – RocketHog55 Nov 30 '22 at 02:52
  • 1
    MariaDB bug requesting support for the ngram parser, which is still open: https://jira.mariadb.org/browse/MDEV-10267 – RocketHog55 Nov 30 '22 at 03:04
  • Yeah... MariaDB started as a fork of MySQL in 2010, but both products have been changing gradually since then. MariaDB has made an effort to make people believe that the two products are compatible, but they aren't, and the differences are increasing over time. You really need to think of MariaDB as a totally different product. Don't use the manual of MySQL to guide you in usage of MariaDB, and vice versa. – Bill Karwin Nov 30 '22 at 03:51
  • Solved by swapping MariaDB for MySQL in XAMPP using this guide https://stackoverflow.com/a/58973750/20394214 – RocketHog55 Nov 30 '22 at 05:47

1 Answers1

1

Apparently XAMPP uses MariaDB despite it saying MySQL in the XAMPP Control Panel and in the error messages. MariaDB doesn't support the ngram parser yet. Solved by swapping MariaDB for MySQL in XAMPP using this guide https://stackoverflow.com/a/58973750/20394214