Spectacu.la Advanced Search
This plug-in provides you with more relevant search results than are currently available to the normal WordPress search and it should also do so with less of a performance hit on the db than the normal WordPress search. We use the MySQL commands MATCH () AGAINST () as opposed to WordPress’ use of LI
This plug-in provides you with more relevant search results than are currently available to the normal WordPress search and it should also do so with less of a performance hit on the db than the normal WordPress search. We use the MySQL commands MATCH () AGAINST () as opposed to WordPress’ use of LIKE to do our queries which are not as heavy on the db. The only issue we have with “match against” is that we need an index on the columns we intend to search on.
The install
- 01Upload spec-adv-search folder to /wp-content/plugins/spec-adv-search/ or the content of the folder to /wp-content/mu-plugins/ . If the directory doesn’t exist then create it.
- 02Activate the plugin through the ‘Plugins’ menu in WordPress.
- 03You should now see an extra menu Advanced search show up under the settings menu in the main admin sidebar.
- 04Go to the new page and hit the “Create Index” button. Once the index has been created you’ll then be able to tick the enable box at the top of the page.
The config
- 05For these search methods to work you’ll need a FULLTEXT index on your post_content and post_title in the wp_posts table. This can be done by using the “create index” button. There are some things to be aware of before you proceed. Firstly adding the index will likely double the size of your wp_posts table, this in and of itself isn’t a problem however if you’re running up against the upper limits of your hosts allowed size then creating an index may push you over that limit. If you do hit your size limit nothing bad should happen but it would be best if you backed up your database first just in case. Always a good idea to run a backup before anything is done to change the db.
- 06Second thing you should know is that the index creation is handled by a Wordpress cron job. Some hosts have problems with wp_cron and if your host is one of those then you will see this “The index creation/deletion is scheduled to start after {date and time}” below the button for a long time after the job was supposed to run. Don’t worry if it’s only a few mins as that is quite normal. If you do have a problem with wp_cron on your server you may find future dated posts don’t become live when you hoped. We can, if you have something like PHPMyAdmin, create the indexes manually by running these commands against your WordPress db: CREATE FULLTEXT INDEX spec_post_content_fulltext ON wp_posts (post_content); CREATE FULLTEXT INDEX spec_post_content_fulltext_title ON wp_posts (post_title);