Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create Full-text search index in MySQL AWS Aurora DB InnoDB engine

Tags:

While trying to add full-text index on the table I am getting below error.

Error Code: 1214. The used table type doesn't support FULLTEXT indexes

And while trying to create a table with MyTSAM engine I am getting below warning message.

0 row(s) affected, 1 warning(s): 1266 Using storage engine InnoDB for table

like image 207
kushagra Avatar asked Mar 27 '19 18:03

kushagra


People also ask

How do I create a full text search in MySQL?

The basic query format of full-text searches in MySQL should be similar to the following: SELECT * FROM table WHERE MATCH(column) AGAINST(“string” IN NATURAL LANGUAGE MODE); When MATCH() is used together with a WHERE clause, the rows are automatically sorted by the highest relevance first.

How do I create a full-text index?

To create a full text index choose your table and right click on that table and select “Define Full-Text Index” option. Now select Unique Index. It is compulsory that for “Full Text Index” table must have at least one unique index. Select columns name and language types for columns.

Does InnoDB support full-text?

Full-text indexes can be used only with MyISAM, Aria, InnoDB and Mroonga tables, and can be created only for CHAR, VARCHAR, or TEXT columns. Partitioned tables cannot contain fulltext indexes, even if the storage engine supports them.

Does MySQL have full text search?

MySQL has support for full-text indexing and searching: A full-text index in MySQL is an index of type FULLTEXT . Full-text indexes can be used only with InnoDB or MyISAM tables, and can be created only for CHAR , VARCHAR , or TEXT columns.


1 Answers

AWS Aurora supports full text indexing. We're using it with InnoDb (MySQL 5.7) tables like:

CREATE TABLE full_search_indexes (
  code varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  entity_type varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  full_text text COLLATE utf8mb4_unicode_ci,
  time_created timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  time_updated timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (code,entity_type),
  FULLTEXT KEY full_text (full_text)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
like image 91
Dan Bunea Avatar answered Sep 19 '22 09:09

Dan Bunea