Note that there are some explanatory texts on larger screens.

plurals
  1. POMySQL FULLTEXT not working
    primarykey
    data
    text
    <p>I'm attempting to add searching support for my PHP web app using MySQL's FULLTEXT indexes.</p> <p>I created a test table (using the MyISAM type, with a single text field <code>a</code>) and entered some sample data. Now if I'm right the following query should return both those rows:</p> <pre><code>SELECT * FROM test WHERE MATCH(a) AGAINST('databases') </code></pre> <p>However it returns none. I've done a bit of research and I'm doing everything right as far as I can tell - the table is a MyISAM table, the FULLTEXT indexes are set. I've tried running the query from the prompt and from phpMyAdmin, with no luck. Am I missing something crucial?</p> <hr> <p><strong>UPDATE:</strong> Ok, while Cody's solution worked in my test case it doesn't seem to work on my actual table:</p> <pre><code>CREATE TABLE IF NOT EXISTS `uploads` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` text NOT NULL, `size` int(11) NOT NULL, `type` text NOT NULL, `alias` text NOT NULL, `md5sum` text NOT NULL, `uploaded` datetime NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=6 ; </code></pre> <p>And the data I'm using:</p> <pre><code>INSERT INTO `uploads` (`id`, `name`, `size`, `type`, `alias`, `md5sum`, `uploaded`) VALUES (1, '04 Sickman.mp3', 5261182, 'audio/mp3', '1', 'df2eb6a360fbfa8e0c9893aadc2289de', '2009-07-14 16:08:02'), (2, '07 Dirt.mp3', 5056435, 'audio/mp3', '2', 'edcb873a75c94b5d0368681e4bd9ca41', '2009-07-14 16:08:08'), (3, 'header_bg2.png', 16765, 'image/png', '3', '5bc5cb5c45c7fa329dc881a8476a2af6', '2009-07-14 16:08:30'), (4, 'page_top_right2.png', 5299, 'image/png', '4', '53ea39f826b7c7aeba11060c0d8f4e81', '2009-07-14 16:08:37'), (5, 'todo.txt', 392, 'text/plain', '5', '7ee46db77d1b98b145c9a95444d8dc67', '2009-07-14 16:08:46'); </code></pre> <p>The query I'm now running is:</p> <pre><code>SELECT * FROM `uploads` WHERE MATCH(name) AGAINST ('header' IN BOOLEAN MODE) </code></pre> <p>Which should return row 3, header_bg2.png. Instead I get another empty result set. My options for boolean searching are below:</p> <pre><code>mysql&gt; show variables like 'ft_%'; +--------------------------+----------------+ | Variable_name | Value | +--------------------------+----------------+ | ft_boolean_syntax | + -&gt;&lt;()~*:""&amp;| | | ft_max_word_len | 84 | | ft_min_word_len | 4 | | ft_query_expansion_limit | 20 | | ft_stopword_file | (built-in) | +--------------------------+----------------+ 5 rows in set (0.02 sec) </code></pre> <p>"header" is within the word length restrictions and I doubt it's a stop word (I'm not sure how to get the list). Any ideas?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload