Identifying a plugin that fits your exact needs vs the tens or even hundreds of alternatives in the WordPress plugin repository can be a meticulous process. Aiming to ease that process is central to our WP Plugin Compare (WPPC) project.
Our initial release included a handy comparison table that served as a starting point for comparative analysis. We also added supporting filters in a subsequent release to surface plugins that meet criteria relevant to your goals.
In our latest release, we’ve addressed another essential research tool: search!
While pre-made comparisons are a great way to share a list of researched plugins, a robust search is the starting point for finding a great solution among many good ones. We identified two attributes we wanted to achieve in this iteration of WPPC search — speed and a seamless lead on to the compare page.
WPPC 🤝 Elasticsearch
Elasticsearch is the go-to solution for all kinds of text-search needs in applications as wide as e-commerce catalogs, log monitoring, big data analytics, fraud detection, and recommendation engines. The technology is tested at the highest level with Enterprise Search, as well as on millions of sites through WordPress plugins such as Jetpack Search, ElasticPress, and WP Solr.
Elasticsearch is based on the Lucene search engine and can be understood as a document-oriented NoSQL data store that can manage large-scale indexing processes at a custom speed. Elasticsearch is fast because of two main features – it’s “inverted indexing” and parallelized queries.
Setting up Elasticsearch
We zeroed in on 3 data fields from our WP.org plugin data source to be indexed – ‘slug’, ‘title’, and ‘short_description’. We figured that even if the name and associated branding of a WordPress plugin changes, the keywords describing their functionality should remain similar. This enables users to discover relevant plugins, even after rebranding or ownership changes.
To fetch the appropriate matches after indexing, we used a bool query. The match conditions are processed across all three indexed fields under a ‘must_match’ parameter. We also included a ‘must_not’ field where a simple full-text match query passes to exclude matches with the plugins not needed in the search results. For example, it excludes the plugins that are already available in the comparison table. We also leveraged Elasticsearch’s search_as_you_type field type for autocomplete.
Elasticsearch uses weighted scores for filtering and ranking keyword matches, enabling relevant keywords to appear higher during a search. We calibrated using the following criteria: slug matching > short_description matching > title matching. For the drop-down results, we filtered by plugin name, number of installations, and rating data.
On the roadmap
The search feature was a long time coming. With our Elasticsearch implementation, finding and comparing 59k+ plugins became just a little bit easier!
Our next run of updates will focus on relevancy tuning by reassessing the weights and boosts, and implementing a search integration in the filter page for a more intuitive user experience.
Also, currently, the script used for uploading data to the backend of the WP Plugin Compare site also sends requests to Elasticsearch to insert/update data twice a day. Eventually, we will set up a pipeline that automatically updates data from the WordPress backend to our Elasticsearch instance in real time.
Have an interesting feature we can help roll out to your web property? We’d love to chat!