Improve search results

Intranet search runs on the Relevanssi Premium plugin, with the theme deciding what is searched, how the results page looks and a few extras such as spelling correction. Most “search can’t find it” problems come down to content rather than settings: the words people type are not in the page title, content or keywords. This page explains what search looks at, how results are ordered and every lever you have. The settings screen itself is described in Search options.

What intranet search covers

  • Content: every kind of content that is switched on in Options, Modules: pages, tasks and guides, news, news updates, blog posts, events, projects, teams, team news, vacancies and training courses. Only published items are searched; drafts, pending and binned items never appear.
  • Staff: when the staff directory is on, people are found by name, job title, team, key skills and bio, and a Staff filter appears on the results page. Staff matches are weighted so that a colleague’s name comes near the top.
  • Documents: files in the media library are only searched when Enable attachments filter is on in Options, Search and Relevanssi is set to index attachments. Whether or not that is on, the titles of files attached to a page through its Documents panel are indexed as part of that page, so a search for a form’s name finds the page it lives on.

Ampersands are kept, so “R&D” is searchable. Intraverts and ultraverts are never in search.

How results are ordered

Relevanssi scores each item on how often and where the search words appear. A match in the title counts far more than one in the content, and each kind of content has a weight you can adjust, so tasks can outrank news, for instance. The theme then shows the results ten to a page (adjustable in Search options) in relevance order, with a Date option for people who want the newest first.

Each result shows the title, with the matching words highlighted, and a snippet that Relevanssi builds from the part of the content where the search words occur. The page’s own Excerpt box is not what is shown here, and it is only searched at all if Relevanssi is set to index excerpts, which it is not by default. Put the words that matter in the content.

Write for search: titles, content and keywords

  • Title: the strongest signal. Use the words staff use, not the department’s name for the thing. “Claim expenses” beats “Expenses policy and procedure (Finance)”.
  • Content: the first paragraph should say plainly what the page is about, in the words people would search for. Put form names and reference numbers in the text, not only in an attached PDF.
  • Keywords: every page, task, news story, event, project, vacancy, team and training course has a Keywords box under the editor. Enter the other words people might use: synonyms, old names, abbreviations, common misspellings. Separate them with spaces; there is no need to repeat words already in the title or content. Keywords are searched only when Relevanssi is set to index custom fields (see the settings below); an administrator can check that once for the whole site. Keywords are not tags: see Find out the difference between tags and keywords.

Pin the right page to a search term

When a search term has one definitive answer, an editor can pin that page so it always comes first for that term. It is shown with a Promoted badge. Pinning overrides relevance for everyone, so use it for a handful of key pages, not routinely; the theme shows a reminder on save when a page is pinned, and it removes the “pin for all searches” option outright because that puts one page at the top of every search. See Promote items in search results.

Hide pages from search

A page can be excluded from the search index from its edit screen, a whole category can be excluded in Relevanssi’s settings, and a member of staff can be hidden from search and the directory from their profile. See Stop something appearing in search results.

Theme search options that change results

All of these are in Options, then Search, and are described in full in Search options: the search stemmer, which matches “claim”, “claims” and “claiming” as one word (rebuild the Relevanssi index after changing it); spelling corrections and Did you mean, both on by default, which rescue a search that finds nothing; helpful search, which sends a search with exactly one result straight to that page; the attachments filter, which adds documents to the results; results per page; and the Search not found message, a good place for a link to the A to Z or a feedback form.

Relevanssi settings that work well on an intranet

Go to Settings, then Relevanssi Premium. These are the settings we find give good results; the names are from Relevanssi Premium 2.31. Save, then select Build the index on the Indexing tab after changing anything under Indexing.

  • Default operator: AND, with Fallback to OR on. A search for “annual leave” then finds pages with both words first, and only falls back to pages with either word when nothing has both. This suits staff who type one to three words.
  • Keyword matching: “Partial words if no hits for whole words”. Exact words first; partial matches only as a rescue.
  • Weight multipliers (Searching tab): give tasks and guides a higher weight than news, so the how-to page outranks last year’s announcement about it.
  • Post types (Indexing tab): tick only the content types that are switched on in the theme.
  • Custom fields (Indexing tab): “Index visible custom fields only”. This is what makes the Keywords box searchable. Avoid “Index all custom fields” with ACF: it pulls internal field data into the index and into excerpts.
  • Attachments tab: leave file contents unindexed unless you need search inside documents. Relevanssi Premium reads files by sending them to its own processing server, so do not switch it on for files with sensitive or personal data.
  • Query logging (Admin & Dev tab): keep the log on. It feeds the (Govintra) Search terms report, which shows what staff search for and which searches find nothing: the best guide to which pages need better titles and keywords.
  • Stopwords (Indexing tab): Relevanssi ignores common words. Remove any from the list that staff genuinely search for on your intranet, such as “it” for the IT team.

Ultimately it is a case of reading the search log, testing and tweaking, and above all writing good titles, content and keywords.

Related