Implementing Global Search & Personalized Suggestions for the Commons

Humanities Commons is powered by WordPress, and its social features like groups and member profiles depend on BuddyPress. Because of the way groups and members are stored in the database, there was no easy way for users to search all the content on the site in a single interface. Earlier this year we implemented a solution to this problem: ElasticPress-BuddyPress.

We decided to start with the ElasticPress plugin by 10up which handles indexing and querying WordPress posts, pages, discussion forum posts, and CORE deposits. The plugin provides an interface for developers to implement custom features, which we used to integrate BuddyPress content into search. In order to leverage the power of the way ElasticPress integrates with posts, we needed a shim to translate groups and members into the post schema used by the search index. This lets us use core WordPress functionality like The Loop to query groups and members together with posts, which in turn allows users to search all of that content at once.

Search results now come from the ElasticSearch backend service managed through ElasticPress, and our custom feature in ElasticPress-BuddyPress ensures BuddyPress groups and members are indexed along with forum posts and deposits. The user interface includes facets to filter results by network and content type. These facets were one of the main contact points during user testing, which resulted in several iterations from traditional multiselect form inputs to toggleable buttons that filter results live on the page.

This new way of querying BuddyPress content affords more opportunities than just searching everything at once. The recently launched suggestions widget on the homepage depends on the same underlying search integration. For users who have entered Academic Interests in their profile, the suggestions that appear are in fact search results of an automated query based on those interests. We are still refining and testing the way suggestions work, but we plan to progressively add relevant contextual suggestions across the site. In addition to supporting ongoing Humanities Commons feature development, we think the ElasticPress-BuddyPress plugin has the potential to be a powerful addition to any site running BuddyPress, especially those running Commons In A Box.

If you haven’t already, try out the new features!

Global search

Suggestions (enter Academic Interests on your profile for personalized results)


Ryan Williams is a web developer at MLA working on Humanities Commons.

Leave a Reply

Your e-mail address will not be published. Required fields are marked *.