building a better search: development of a wordpress search api

13
Building a Better Search: Development of a WordPress Search API Page 1 Justin Shreve Introduction Building a Better Search: Development of a WordPress Search API Justin Shreve

Upload: justin-shreve

Post on 31-Aug-2014

5.181 views

Category:

Technology


4 download

DESCRIPTION

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

TRANSCRIPT

Page 1: Building a Better Search: Development of a WordPress Search API

Building a Better Search: Development of a WordPress Search API

Page 1Justin Shreve

Introduction

Building a Better Search:Development of a WordPress Search API

Justin Shreve

Page 2: Building a Better Search: Development of a WordPress Search API

Building a Better Search: Development of a WordPress Search API

Page 2Justin Shreve

A Google Summer of Code Project

• Students worked with mentors (WordPress staff and community members) to develop and improve open source software

• Annual program (held from May to August)• Phases:

• Community bonding time• Interim period (development)• Mid-term evaluations• Interim Period (Write tests, documentation)• Final evaluations

Page 3: Building a Better Search: Development of a WordPress Search API

Building a Better Search: Development of a WordPress Search API

Page 3Justin Shreve

WordPress Community Interaction

• Mentor - Andy Skelton • http://andyskelton.com/

• User/Community Feedback• Forums• Issue Tracker• Development Chats

Page 4: Building a Better Search: Development of a WordPress Search API

Building a Better Search: Development of a WordPress Search API

Page 4Justin Shreve

Blogging to Improve the Project

Summer of WordPress Development Bloghttp://gsoc2009wp.wordpress.com/

• Weekly blog posts• Progress reports and upcoming developments• Invited comment and conversation

( http://gsoc2009wp.wordpress.com/author/justin/ )

“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……

Page 5: Building a Better Search: Development of a WordPress Search API

Building a Better Search: Development of a WordPress Search API

Page 5Justin Shreve

Selecting and Planning the Project

• View WordPress’ ideas list and Google Summer of Code documentation– http://codex.wordpress.org/GSoC2009

• With these ideas in mind assess WordPress’ current limitations• Look to the community

– Look at feedback about WordPress features– Focus on useful enhancements

• Chose to improve search functionality

Page 6: Building a Better Search: Development of a WordPress Search API

Building a Better Search: Development of a WordPress Search API

Page 6Justin Shreve

Rationale Behind the Project

• Limitations of the Current WordPress Search Engine– Both the blog and admin elements are very basic

– Very little admin control– Can only search posts and pages– Can not easily filter results by multiple metadata selections

• You can not do the following search: posts in category A with tags B and C; posts with author A and "text string”

– Does not support modern search capabilities• AND, OR• Stemming• Spell Checking

Page 7: Building a Better Search: Development of a WordPress Search API

Building a Better Search: Development of a WordPress Search API

Page 7Justin Shreve

The Solution

• Build an API to abstract common search functionality• Offer a few suggestions for WordPress Search

• Google plugin • Sphinx plugin

• Ultimately let users and developers choose how they want their content searched (through plugins)• These plugins should address current limitations and fix them

Page 8: Building a Better Search: Development of a WordPress Search API

Building a Better Search: Development of a WordPress Search API

Page 8Justin Shreve

Demo

Page 9: Building a Better Search: Development of a WordPress Search API

Building a Better Search: Development of a WordPress Search API

Page 9Justin Shreve

A Closer Look at the API

• http://wordpress.org/extend/plugins/search/• The API’s Features

– Ability to drop in a new search plugin– Supports a federated search index– Offers easy methods for creating advanced search pages and other similar

functionality ( e.g., pagination, sorting, and filtering )– Makes it easier for plugins to address current limitations

Page 10: Building a Better Search: Development of a WordPress Search API

Building a Better Search: Development of a WordPress Search API

Page 10Justin Shreve

A Closer Look at the Search Plugin(s)

• Bundled Search Plugins– Google

• Uses Google Custom Search to display results on a self-hosted page (Outsources search work to Google).

– MySQL• Improves upon the current MySQL search by adding multiple content

searching, multiple metadata selection and MySQL’s BOOLEAN syntax.– Sphinx

• Offers a powerful alternative for those with slightly more access to their server

• Implements the tools available from the Sphinx open-source full-text engine– http://www.sphinxsearch.com/

Page 11: Building a Better Search: Development of a WordPress Search API

Building a Better Search: Development of a WordPress Search API

Page 11Justin Shreve

Creating a New Plugin

• Implement a new Search plugin in a few easy steps• Create a WordPress file (e.g.: fulltext.php) with a class of the same name

(fulltext_search)– Implement a few variables for the API to communicate through– List the features of the plugin to implement

• Will this engine have an advanced search page? Filters? Sorting option? Pagination? Does it need the search index?

– Implement just two required functions in the class• find_results to query the database• search() to format the results

– Add some activation code for the Search API to understand this is a Search Plugin

Page 12: Building a Better Search: Development of a WordPress Search API

Building a Better Search: Development of a WordPress Search API

Page 12Justin Shreve

What the Future Holds

• Look to the community for further suggestions– Monitor the issue tracker– Monitor discussions from other sites (ThemeHybrid, Twitter, etc)– Monitor WordPress Support forums

• Implement the API in the WordPress core– Patch #10667

Page 13: Building a Better Search: Development of a WordPress Search API

Building a Better Search: Development of a WordPress Search API

Page 13Justin Shreve

Closing

Thank You!