[Plugin: Relevanssi – A Better Search] Bug (and Fix): Stopwords table index
I’ve noticed a serious problem with the stopwords functionality, in that adding words that differed only on accented characters (for example, in Portuguese, ‘pode’ and ‘pôde’) results in only one of them actually entering the database, the other one being considered a duplicate, what clearly isn’t the case. Researching the problem, I noticed it comes down to Relevanssi applying WordPress’ generic collation (in my case,
utf8_unicode_ci) to the
stopwordcolumn in the
wp_relevanssi_stopwordstable. This causes MySQL to consider those two different words as being the same, and thus to only allow one of them.
The solution was to manually change the column collation to utf8_bin with an
ALTER TABLE 'wp_relevanssi_stopwords' CHANGE 'stopword' 'stopword' VARCHAR(50) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL, thus preserving the
UNIQUErestriction in the index while allowing for words that only differ in their accented letters.
My suggestion then is to change the code that creates this table so that its collation becomes
whatever_bin. This is safe because all MySQL collations have a
Here’s the pastebin with my proposed changes to the
I hope this helps!
PS: Two other tables have indexes in the same situation, so my guess is that it’s safe to do the same to them. The above fix does this too.
By the way: it’d be nice to have some way to update these tables for existing installations. Maybe a button in the interface somewhere to manually apply three
- The topic ‘[Plugin: Relevanssi – A Better Search] Bug (and Fix): Stopwords table index’ is closed to new replies.