UPDATE: This issue has been fixed as of version 1.0.8. Additionally, this fix was put into play in less than 24 hours, and that, my friends, is badassssssss.
=== Original Post Below ===
So I’m working on a big project and trying to come to grips with the various WordPress Search Plugins. The problem with the default search capability is that it’s not very good. Fortunately, enterprising folks have stepped into that void, not least of whom are Andy Skelton and Justin Shreve, who, on the very day I was looking for just such a thing, announced an updated Search API plugin. I got the plugin tested it out on my testing app and liked what I saw immediately. It is fast, uses MySQL fulltext indexing (or Google, or Sphinx, or others, by now, probably), has advanced search capabilities built in and is officially sanctioned and will be updated at least for the foreseeable future.
I said to myself, “Self, this is an awesome plugin. It does just what I want. I’m going to install it on my project app and go to town.” So I did, but then the hours of frustration came into play. Basically, any time I would search for anything, it would come back with no results. I said “That’s weird. It works on one app, but not the other. Hmm… What’s the difference?”
Well, it turns out that the project I’m working on is using a different MySQL server than the one on my local box, and it turns out that the remote server uses InnoDB engine by default, and not MyISAM. The problem with that is that InnoDB doesn’t support Fulltext Indexing. So, when you create the table via the plugin installation, it fails silently and your index table fails to exist. So when you are searching a nonexistent index, that fails silently and it just looks like you don’t have any search results.
Now, if you’ve read this far, you probably want to hear how I fixed the problem. Well, you can force a table to use a different engine by tacking on “ENGINE MYISAM” at the tail of your create table statement. I altered the statement, ran it manually, built the index and poof, it worked! Hopefully, a future update will have this rectified (or at least throw an error when the index table doesn’t build), but if not, now you can fix this problem, should you run into it.
For those who are really interested, this is what my create table statement looked like:
create table wp_search_index (`id` bigint(20) NOT NULL auto_increment,`object` bigint(20) NOT NULL,`title` text NOT NULL,`content` text NOT NULL,`post_date` datetime NOT NULL,`parent` bigint(20) NOT NULL,`categories` text NOT NULL,`tags` text NOT NULL,`author` text NOT NULL,`type` varchar(50) NOT NULL,`protected` smallint(6) NOT NULL,PRIMARY KEY (`id`),FULLTEXT KEY `title` (`title`),FULLTEXT KEY `content` (`content`),FULLTEXT KEY `title_and_content` (`title`,`content`)) ENGINE MYISAM;
I’ve emailed Justin about this issue. Thanks for the report.
Big time kudos to Andy and Justin. I wrote this yesterday, and the fix is already in. I’m updating the post to reflect this awesomeness.