In this article, we will see how to create a custom search engine for WordPress that has a robust sort by relevance feature inbuilt. We will also see how the default WordPress search works and how we can improve that with an external plugin.
The Problem with the Default WordPress search relevance
The default WordPress search only considers the following three parameters for its search relevance:
When you do a search on WordPress, it usually does a LIKE match on the title, content and excerpt and then it is sorted by Title matches and then by recent post dates. This results in a sub par WordPress search relevance that can end up giving a bad customer experience on your WordPress site.
Expertrec custom search will return results based on their overall relevance. You will be able to edit the relevance based on multiple post features such as the title, post content, meta tag description, URL permalink, post views, categories and more. Even if you have added any new fields using plugins such as advanced custom fields, even these fields can be taken into consideration.This aids in producing better search results that are suited to your website’s business needs.
- Take a backup of your existing wordpress setup with the backup guard WordPress plugin.
- Go to custom search engine creator and sign in with your Gmail id.
- Enter your website URL.
- Enter your sitemap URL if you have one.
- Initiate a website crawl. (this crawls all your website URLs and creates an usable search engine for your website).
- Once the crawl completes, install the WP fastest site search plugin which adds a search box similar to the image below.
- Copy your API key from your dashboard.
- Open the settings page of your WP fastest site search and paste it there.
- This adds the search engine to your WordPress site along with the search by relevance feature.