Feature

Tip: Faster, Better Search for Movable Type

4 minute read
Brice Dunwoodie avatar
SAVED
Out of the box Movable Type's (MT) search engine isn't terrible. It meets minimum requirements, is fairly accurate, but not much more. The big issue is performance. Under any sort of load, MT's native search starts to creak and groan, and suck gobs of CPU time. Enter Mark Carey and his latest version of Fast Search for MT.Fast Search v1.5 is a (PHP, as opposed to Perl) plugin extension for the Movable Type publishing platform. The plugin provides fast searching of MT blog posts with low CPU load and a flexible query syntax. Fast Search uses the PHP-based dynamic publishing system of Movable Type to search for entries using native MySQL database queries. The new version provides search options that enable the user to choose between MySQL full text searching, a standard SQL LIKE query, or a combination of the two. While full text is the most performant, all of the Fast Search methods yield significant performance gains over MT's native Perl-CGI-based search engine. The latest version of Fast Search for MT includes these new features: * Multi-Byte Character Support. Fast Search can now search entries with content stored in multi-byte characters, such as Arabic and Japanese, using the "Non-Fulltext" search method. * Total Number of Results Found. A new tag for displaying the total number of results in the database, so you can display output such as "Results 1-10 of 256". * Search Page Links. Display linked page numbers to link directly to multiple pages of search results. * Previous Page Link. Links to the previous page of search results. * Short Words Searching. Using the "Non-Fulltext" or "Fallback" search methods, you can now search for words under 4 characters in length. This was a serious limitation inherent with MySQL's full text search -- given the number TLA's in use today. * Match Partial Words. Search for partial words using the "Non-Fulltext" or "Fallback" methods, you can now search for partial words. * "Mixed" Multi-blog Searching. You can now search multiple blogs in the same search. The results are merged into a single list of search results, not grouped by blog. Fast Search will automatically create a MySQL full text index, enabling very fast searches. For people who want to search multi-byte languages or short/partial words, the "Non-Fulltext" option enables this functionality. "Non-Fulltext" conducts a SQL LIKE query that runs in the native MySQL query engine. The Fallback option is a combination search, first trying a full text search, then a LIKE query, if full text returns zero results. The new pagination links feature of v1.5 enables Google-style links to multiple search results pages, along with "Next" and "Previous" buttons. The MySQL full text queries are built and executed within the framework of Movable Type's PHP-based dynamic publishing system. The database content is then displayed via MT templates and tags. The first step of the PHP code is to determine the search query and any optional arguments that need to be considered. The final phase hooks into the Movable Type template system, enabling users to customize the search results pages, just like any other MT template. Fast Search reuses many of the same template tags from the CGI-based search, making it easy for make the switch to much faster searching. One important note for those considering the transition: In case its not obvious, Fast Search relies on the MySQL database engine as the backend for search. Therefore to utilize this product, your MT installs must already be storing content in a MySQL database. This is not a given. In fact many MT installs are configured to use Berkeley DB file system databases. Fast Search v1.5 is a commercial extension to the Movable Type publishing platform. It is free for non-commercial use or about US$ 100 for grubby capitalists like you and me. You MT enthusiasts can download the software from the popular MT Hacks website

About the Author

Brice Dunwoodie

Brice is the founder of Simpler Media Group, Inc., the organization behind the CMSWire and Reworked publications, and the creator of the DX Summit and Digital Workplace Experience conferences. Connect with Brice Dunwoodie: