---
slug: "MySQLInnoDBのフルテキストインデックスで、ストップワードフィルタを無効にする(in,by,isなどで検索できるようにする)"
title: "Disable Stopword Filter in MySQL InnoDB Full-Text Index to Allow Searching for Words like \"in,\" \"by,\" \"is\""
description: "\n\n\nBackground\nI'm creating a full-text index with bigrams in InnoDB on MySQL 5.6. However, when I tried to search for the term \"TWIN,\""
url: "https://www.ytyng.com/en/blog/MySQLInnoDBのフルテキストインデックスで、ストップワードフィルタを無効にする(in,by,isなどで検索できるようにする)"
publish_date: "2015-12-01T06:42:57Z"
created: "2015-12-01T06:42:57Z"
updated: "2026-02-27T11:04:19.041Z"
categories: ["MySQL"]
keywords: ""
featured_image_url: "https://media.ytyng.com/resize/20230812/02638a1df05f44c0a634deb8694e6fc6.png.webp?width=768"
has_video: false
has_music: false
video_urls: []
music_urls: []
lang: "en"
---

# Disable Stopword Filter in MySQL InnoDB Full-Text Index to Allow Searching for Words like "in," "by," "is"

<div class="document">

<div class="section" id="id1">
<h3>Background</h3>
<p>I'm creating a full-text index with bigrams in InnoDB on MySQL 5.6. However, when I tried to search for the term "TWIN,"</p>
<pre class="literal-block">SELECT COUNT(*) FROM ...
WHERE MATCH(search_text) AGAINST ('+tw +wi +in' IN BOOLEAN MODE)
</pre>
<p>... no results were returned.</p>
<p>When I searched with '+tw +wi', results were returned (matching 'twin').</p>
<p>Upon investigation, I discovered a feature called "stopwords," which prevents certain words like "in," "by," and "is" from being indexed for searches.</p>
<p>Note: This is only for InnoDB's full-text index. In MyISAM, the default does not use a stopword table.</p>
<p>To display the contents of the stopword table:</p>
<pre class="literal-block">SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_DEFAULT_STOPWORD;
</pre>
<p>It includes words like 'in,' 'is,' 'it,' 'la,' 'of,' 'on,' etc.</p>
<p>You can create your own stopword table and configure MySQL to use it, but for now, I will disable the stopword table's filtering during index generation entirely.</p>
<p>If you don't want to disable it but just replace the stopword table, this page might be helpful:</p>
<p>MySQL :: MySQL 5.6 Reference Manual :: 12.9.4 Full-Text Stopwords</p>
<p><a class="reference external" href="https://dev.mysql.com/doc/refman/5.6/en/fulltext-stopwords.html">https://dev.mysql.com/doc/refman/5.6/en/fulltext-stopwords.html</a></p>
</div>

<div class="section" id="id2">
<h3>Disabling Stopwords</h3>
<p>To disable stopwords in InnoDB, change the innodb_ft_enable_stopword setting.</p>
<p>Check the current setting:</p>
<pre class="literal-block">SHOW VARIABLES LIKE 'innodb_ft_enable_stopword';
</pre>
<pre class="literal-block">innodb_ft_enable_stopword   ON
</pre>
<p>By default, it is enabled.</p>
<p>So, add the following to your my.cnf or other configuration file:</p>
<pre class="literal-block">[mysqld]
innodb_ft_enable_stopword = OFF
</pre>
<p>After restarting MySQL:</p>
<pre class="literal-block">SHOW VARIABLES LIKE 'innodb_ft_enable_stopword';
</pre>
<pre class="literal-block">innodb_ft_enable_stopword   OFF
</pre>
<p>The change will be applied.</p>
<p>On Ubuntu, you can place the configuration file in the /etc/mysql/conf.d/ directory.</p>
<p>Here's what my configuration looks like:</p>
<p>/etc/mysql/conf.d/fulltext_search.cnf</p>
<pre class="literal-block">[mysqld]
# Fulltext search bigram settings.
ft_min_word_len = 2
innodb_ft_min_token_size = 2
innodb_ft_enable_stopword = OFF
</pre>
</div>

<div class="section" id="id3">
<h3>Regenerating the Search Index</h3>
<p>To regenerate the index,</p>
<p>use not REPAIR TABLE table_name QUICK; (this is for MyISAM)</p>
<p>but for InnoDB,</p>
<pre class="literal-block">ALTER TABLE table_name FORCE;
</pre>
<p>After running this command:</p>
<pre class="literal-block">SELECT COUNT(*) FROM ...
WHERE MATCH(search_text) AGAINST ('+tw +wi +in' IN BOOLEAN MODE)
</pre>
<p>→ Results were returned!</p>
</div>

</div>
