Companies like Google, Amazon and Netflix have got us used to searching for what we want and getting immediate, relevant results. But the internal search function on your website won’t always meet these expectations. Let’s look at some ways to improve the experience.

How internal site search works

The internal search function allows the website visitor to find content on your site by typing a search term into a search form. Giving people different ways to navigate to your content is one way of making your site accessible.

In their most basic form, search functions work like this:

  1. Content is added to the search index.
  2. A search algorithm scores the indexed content.
  3. The user enters a search term/query.
  4. Search results display the content based on its score for the search term.

Make sure the content is indexable

Not all content is added to the search index. For example, bots can’t read an image, so you need to add alt text to images on your site. Say that you display a company name using an image of its logo. The content won’t appear in the search results for the company name unless the company name is set as the image’s alt text.

In the Craft content management system, an entry’s title field is indexed as well as any text in the entry’s content fields that have the ‘Use this field’s values as search keywords’ checkbox selected. Get your developer to check that the fields with content that you want to be found have this checkbox selected in the field settings.

Optimise your content

The search algorithm gives the content a score for the search term and displays the entry with the highest score first. To optimise the content for the search algorithm, you need to know a bit about how it works. You can then apply this knowledge as you write and organise the page content.

We can’t cover every search algorithm available, so we’re going to focus on the native search algorithms that come packaged in two of the most popular content management systems: WordPress and Craft.

The search algorithm in Craft works roughly like this:

  1. It gives the entry a score if it includes the keyword(s) used in the search term in one of the entry’s indexable content fields.
  2. It gives a higher score if it includes the keyword(s) in the entry’s title field.
  3. If the search term has more than one keyword, the algorithm gives the entry a higher score if it includes all the keywords. The score is higher still if the keywords are in the same order.

Get more details about how Craft’s search algorithm works from their documentation.

The WordPress search function works roughly the same as the one in Craft. WordPress used to order the search results by the date the entry was published, but it now uses better scoring.

Search engines like Google Search use natural language processing to understand how different words and phrases relate to each other. For example, they know that the word ‘childcare’ and the word ‘nursery’ relate to each other. As your CMS’s native search algorithm doesn’t do this, you need to make sure that you include synonyms and related words in your content.

Remember: if the word isn’t included in your content, then the content won’t appear in the search result for that word.

Add misspellings and typos to a custom field

At William Joseph, we have seen during user testing that people with dyslexia prefer to use the site search (they find it less overwhelming than a wall of site sections). This means that the likelihood of misspellings in their search is higher.

When you use Google Search, it corrects misspellings and typos. But this won’t happen when using your site search (your site doesn’t have the data that Google has collected over the past 20 years). So, for example, if you enter ‘kings’ in your site’s search form, you won’t get the entry titled ‘King’s College London’ in the search results (because it uses an apostrophe).

However, we don’t want misspellings and typos to be in your content. One solution is to get your developer to add a field to your content editor but not include it in your entry template. You can then add these words to the entry using this field without displaying them to your site visitors.

Filter the search results

Your developer can edit your search form function so that it searches a particular section of your site. For example, if you have an events section, include a search field at the top of the events page that only lists event entries in the search results.

Add popular search terms as autocomplete options

Modern browsers store search terms previously entered across domains. These then come up as autocomplete options when you perform searches in a search field on a different domain name. This means that you don’t have to type out the full word or phrase – you can select it from the list displayed when you start typing into the search field.

If you have a list of popular search terms used on your site, get your developer to set these as autocomplete options on your site search form. Alternatively, they could query the titles of the entries on your site and use these as autocomplete options.

More options

The suggestions here should improve the usability of your site’s search function. For a fee, there are also other platforms to use for your site search function, like Algolia. Or to take advantage of Google Search’s algorithm, use their API.