Skip to main contentSkip to footer

Utf8mb4 charset and index problems

If you use utf8mb4 charset, Relevanssi database table may be missing an index. That’s because part of the index includes a column type that is of varchar(210) type. This is fine with utf8, but fails for utf8mb4, which only allows columns 191 characters long (because maximum column size is 767 bytes, and for 4-byte utf8mb4 characters that means 191 × 4 = 764 bytes).

To fix this, the column type needs to be shortened to varchar(191) and the index created again:

CREATE INDEX typeitem ON wp_relevanssi (type, item)

This seems to vary between servers; in some cases this fails and ends up with an error message, in some cases the index will automatically include only the first 191 characters of the column.

Also, if you shorten the column to 191 characters, you may run into problems if you have taxonomy slugs that are more than 191 characters long. Unlikely, yes, but something to be aware of.

Your account

Not logged in. Log in to see your license details.

Search

Popular Resources

Genesis

…Genesis make small changes like these more complicated. Sarah Moyer took the effort to figure out how to make the necessary changes in Genesis. First, in order to get the correct permalink in the post title, add this code to your site: // Modify content to add Featured Images and……Relevanssi permalink add_action( ‘genesis_entry_content’, ‘child_do_post_excerpt’, 1 ); function child_do_post_excerpt() { if (is_search()) { remove_all_actions( ‘genesis_entry_content’ ); // Get featured image if page or post the_post_thumbnail( ‘medium’, array( ‘class’ => ‘alignright’ ) ); // Uncomment the following lines to get featured image if WooCommerce product category – this doesn’t work if……( function_exists( ‘relevanssi_get_permalink’ ) ) { echo ‘<a class=”read-more-link” href=”‘ . esc_url( relevanssi_get_permalink() ) . ‘”>View more »</a>’; } } } Then, for excerpts: // Modify content to add Featured Images and Relevanssi permalink add_action( ‘genesis_entry_content’, ‘child_do_post_excerpt’, 1 ); function child_do_post_excerpt() { if ( is_search() ) { remove_all_actions( ‘genesis_entry_content’ );…

Related Posts:

Currently there are no related posts available.

Comment Section:

Leave a Reply

Your email address will not be published. Required fields are marked *

Fill out this field
Fill out this field
Please enter a valid email address.
You need to agree with the terms to proceed