Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Building a Better Search: Development of a WordPress Search API


Published on

A copy of the slides being shown the conference session "Building a Better Search: Development of a WordPress Search API" during WordCamp NYC 2009.

Published in: Technology, Business
  • Be the first to comment

  • Be the first to like this

Building a Better Search: Development of a WordPress Search API

  1. 1. Introduction Building a Better Search: Development of a WordPress Search API Justin Shreve
  2. 2. A Google Summer of Code Project <ul><li>Students worked with mentors (WordPress staff and community members) to develop and improve open source software </li></ul><ul><li>Annual program (held from May to August) </li></ul><ul><li>Phases: </li></ul><ul><ul><li>Community bonding time </li></ul></ul><ul><ul><li>Interim period (development) </li></ul></ul><ul><ul><li>Mid-term evaluations </li></ul></ul><ul><ul><li>Interim Period (Write tests, documentation) </li></ul></ul><ul><ul><li>Final evaluations </li></ul></ul>
  3. 3. WordPress Community Interaction <ul><li>Mentor - Andy Skelton </li></ul><ul><ul><li> </li></ul></ul><ul><li>User/Community Feedback </li></ul><ul><ul><li>Forums </li></ul></ul><ul><ul><li>Issue Tracker </li></ul></ul><ul><ul><li>Development Chats </li></ul></ul>
  4. 4. Blogging to Improve the Project <ul><li>Summer of WordPress Development Blog </li></ul><ul><ul><li> </li></ul></ul><ul><ul><ul><li>Weekly blog posts </li></ul></ul></ul><ul><ul><ul><li>Progress reports and upcoming developments </li></ul></ul></ul><ul><ul><ul><li>Invited comment and conversation </li></ul></ul></ul>( ) “ In response to last night’s dev chat and a follow up by John Myrstad I have released a new version. The new release includes the ability to search by post tags and custom taxonomies (through register_taxonomy) as well as some improvements to the code and how the category selector on the advanced search page is showed…… ”
  5. 5. Selecting and Planning the Project <ul><li>View WordPress’ ideas list and Google Summer of Code documentation </li></ul><ul><ul><li> </li></ul></ul><ul><li>With these ideas in mind assess WordPress’ current limitations </li></ul><ul><li>Look to the community </li></ul><ul><ul><li>Look at feedback about WordPress features </li></ul></ul><ul><ul><li>Focus on useful enhancements </li></ul></ul><ul><li>Chose to improve search functionality </li></ul>
  6. 6. Rationale Behind the Project <ul><li>Limitations of the Current WordPress Search Engine </li></ul><ul><ul><li>Both the blog and admin elements are very basic </li></ul></ul><ul><ul><ul><li>Very little admin control </li></ul></ul></ul><ul><ul><li>Can only search posts and pages </li></ul></ul><ul><ul><li>Can not easily filter results by multiple metadata selections </li></ul></ul><ul><ul><ul><li>You can not do the following search: posts in category A with tags B and C; posts with author A and &quot;text string” </li></ul></ul></ul><ul><ul><li>Does not support modern search capabilities </li></ul></ul><ul><ul><ul><li>AND, OR </li></ul></ul></ul><ul><ul><ul><li>Stemming </li></ul></ul></ul><ul><ul><ul><li>Spell Checking </li></ul></ul></ul>
  7. 7. The Solution <ul><li>Build an API to abstract common search functionality </li></ul><ul><li>Offer a few suggestions for WordPress Search </li></ul><ul><ul><li>Google plugin </li></ul></ul><ul><ul><li>Sphinx plugin </li></ul></ul><ul><li>Ultimately let users and developers choose how they want their content searched (through plugins) </li></ul><ul><li>These plugins should address current limitations and fix them </li></ul>
  8. 8. Demo
  9. 9. A Closer Look at the API <ul><li> </li></ul><ul><li>The API’s Features </li></ul><ul><ul><li>Ability to drop in a new search plugin </li></ul></ul><ul><ul><li>Supports a federated search index </li></ul></ul><ul><ul><li>Offers easy methods for creating advanced search pages and other similar functionality ( e.g., pagination, sorting, and filtering ) </li></ul></ul><ul><ul><li>Makes it easier for plugins to address current limitations </li></ul></ul>
  10. 10. A Closer Look at the Search Plugin(s) <ul><li>Bundled Search Plugins </li></ul><ul><ul><li>Google </li></ul></ul><ul><ul><ul><li>Uses Google Custom Search to display results on a self-hosted page (Outsources search work to Google). </li></ul></ul></ul><ul><ul><li>MySQL </li></ul></ul><ul><ul><ul><li>Improves upon the current MySQL search by adding multiple content searching, multiple metadata selection and MySQL’s BOOLEAN syntax. </li></ul></ul></ul><ul><ul><li>Sphinx </li></ul></ul><ul><ul><ul><li>Offers a powerful alternative for those with slightly more access to their server </li></ul></ul></ul><ul><ul><ul><li>Implements the tools available from the Sphinx open-source full-text engine </li></ul></ul></ul><ul><ul><ul><ul><li> </li></ul></ul></ul></ul>
  11. 11. Creating a New Plugin <ul><li>Implement a new Search plugin in a few easy steps </li></ul><ul><li>Create a WordPress file (e.g.: fulltext.php) with a class of the same name (fulltext_search) </li></ul><ul><ul><li>Implement a few variables for the API to communicate through </li></ul></ul><ul><ul><li>List the features of the plugin to implement </li></ul></ul><ul><ul><ul><li>Will this engine have an advanced search page? Filters? Sorting option? Pagination? Does it need the search index? </li></ul></ul></ul><ul><ul><li>Implement just two required functions in the class </li></ul></ul><ul><ul><ul><li>find_results to query the database </li></ul></ul></ul><ul><ul><ul><li>search() to format the results </li></ul></ul></ul><ul><ul><li>Add some activation code for the Search API to understand this is a Search Plugin </li></ul></ul>
  12. 12. What the Future Holds <ul><li>Look to the community for further suggestions </li></ul><ul><ul><li>Monitor the issue tracker </li></ul></ul><ul><ul><li>Monitor discussions from other sites (ThemeHybrid, Twitter, etc) </li></ul></ul><ul><ul><li>Monitor WordPress Support forums </li></ul></ul><ul><li>Implement the API in the WordPress core </li></ul><ul><ul><li>Patch #10667 </li></ul></ul>
  13. 13. Closing Thank You!