Custom Solr Implementation
Check it outCustom Solr Implementation
The problem
- The organization’s website incorporates data from several different sources.
- The built-in WordPress sitewide search could only query the WordPress database, leaving out important results from other sources, including the provider profile database and event data from Eventbrite.
The solution
- Since the site is hosted on Pantheon, I was able to take advantage of the available Solr Index Server with minimal setup.
- To integrate data from additional sources, I built a WordPress plugin to extend the Pantheon Solr integration, providing a sitewide search that includes all the information represented on the site, regardless of source.
How it works
- When event data from Eventbrite is refreshed (more on that here), the plugin updates the event information in the Solr index.
- Since provider profile data isn’t cached on this system, I built a WordPress REST API endpoint for the provider profile system to hit whenever a profile is created, updated, or deleted. When that happens, the plugin takes the appropriate action on the Solr index, keeping it always up-to-date.
- The plugin’s admin interface provides tools for reindexing all provider profiles and for reindexing or deleting any specific profile. There are also tools for updating Solr search synonyms and viewing the API call log.
- The plugin also filters search results to exclude any WordPress content marked noindex in Yoast meta unless the user is logged in. This allows admins to use Solr search on all content, while preventing unlisted content from being returned to the public.
- Over a month or so of testing and monitoring search queries and results, I was able to customize the Solr schema to meet the organization’s search logic priorities.