Tuesday, September 15, 2020

[google-cloud-sql-discuss] Re: Character Set Modifications for MySQL innoDB on CloudSQL

Cloud SQL MySQL only support character_set_server which 'stringutf8 or utf8mb4 (recommended)'

On Thursday, September 10, 2020 at 11:56:01 AM UTC-4 tim...@gmail.com wrote:
There's a need to add a couple of new characters as word characters for better fulltext indexing in our app. The solutions are doable on our local environments but not in CloudSQL.

The MySQL 5.7 docs suggest the following 3 methods for making modifications to the character sets to change fulltext indexing behaviour. None of them are doable with CloudSQL in its current state as far as I can tell. 

Character Set Modifications

For the built-in full-text parser, you can change the set of characters that are considered word characters in several ways, as described in the following list. After making the modification, rebuild the indexes for each table that contains any FULLTEXT indexes. Suppose that you want to treat the hyphen character ('-') as a word character. Use one of these methods:

  • Modify the MySQL source: In storage/innobase/handler/ha_innodb.cc (for InnoDB), or in storage/myisam/ftdefs.h (for MyISAM), see the true_word_char() and misc_word_char() macros. Add '-' to one of those macros and recompile MySQL.

  • Modify a character set file: This requires no recompilation. The true_word_char() macro uses a "character type" table to distinguish letters and numbers from other characters. . You can edit the contents of the <ctype><map> array in one of the character set XML files to specify that '-' is a "letter." Then use the given character set for your FULLTEXT indexes. For information about the <ctype><map> array format, see Section 10.13.1, "Character Definition Arrays".

  • Add a new collation for the character set used by the indexed columns, and alter the columns to use that collation. For general information about adding collations, see Section 10.14, "Adding a Collation to a Character Set". For an example specific to full-text indexing, see Section 12.10.7, "Adding a User-Defined Collation for Full-Text Indexing".

Is there away to extend the character sets used in CloudSQL's mysql or another way in cloudsql to add additional word characters for the purpose of fulltext indexing?

--
You received this message because you are subscribed to the Google Groups "Google Cloud SQL discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-cloud-sql-discuss+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-cloud-sql-discuss/c31d34a5-06e0-4244-a3bc-23fb5f188906n%40googlegroups.com.

No comments:

Post a Comment