There are two basic types of search functions in your knowledge base:
- Autosuggest: When a reader starts typing into the search bar, we will instantly suggest possible articles based on what they've typed.
- Full text search: When the reader hits enter or clicks on the search button, they are redirected to a search results page which provides the full text search results.
Below is a breakdown of the main differences between autosuggest and full text search.
Autosuggest | Full text search |
---|---|
Suggests below the search bar as you type | Displays on search results page after hitting enter |
Searches title, search phrases, permalink, and meta description (no body or PDFs for speed) | Searches title, body, pdfs, search phrases, permalink, and meta description |
No synonyms | Synonyms |
Limited to top 10 suggestions | Displays full results with pagination |
Highlights differences in title | Highlights matches in blurb |
The goal of autosuggest search is provide the reader with intelligent article suggestions based on what they type in the search box.
In order for it to be as fast as possible, we only search within the title, search phrases, permalink, and meta description. We index N-grams, or continuous sequences of characters, from these search fields.
For example, if I have an article called "Autosuggest", we would index a series of N-grams like "a", "au", "aut", and so on. This way, the search can instantly suggest possible matches as the reader types.
We check through all the searchable fields for possible matches and calculates a relevancy score. The field with the best possible match gets a boost, but we also factor in other matching fields as well as any customized search weights.
Autosuggest doesn't require an exact match to suggest relevant articles, and you can choose to make it fuzzy (tolerant of typos).
The goal of full text search is to provide the reader with all of the relevant results.
The main measurements of search are precision and recall.
- Precision is the percentage of search results that are relevant. For example, if your search returns 100 articles but only 80 of them are relevant, the precision is 80%.
- Recall is the percentage of total relevant article that are returned in the search. If your search term should match 10 relevant articles but only 9 are returned, the recall is 90%.
It's very difficult, and many would argue impossible, to have 100% precision and recall. When you try to ensure that 100% of the relevant articles show up, you often end up including some non-relevant ones too, lowering the precision. When you try to ensure that 100% of the search results are relevant, you often end up excluding some relevant ones, lowering recall.
Our goal is to provide the best possible combination of precision and recall. From our conversations with customers and industry research, we decided it's better to err on the side of recall (including all the relevant articles) and let go of precision to ensure readers are able to find what they need.
Since the search results are sorted by relevancy and most people don't dive too deep into results, having some irrelevant articles showing up lower in the search is better than people not being able to find what they searched for.
You can perform exact match searches by surrounding your search term in quotation marks. When you perform an exact match search, we perform a special algorithm that looks for exact matches for your search term in the search fields. It is not tolerant of typos and does not allow for variations in proximity (search term must appear in the exact order).
You can search for articles by tag, rather than keyword, by putting a colon before the start of the word. This format works in both autosuggest and full text search modes.
Tag search case sensitivity
Tag searches initially are a case-sensitive search (e.g. they will look for :Search if that's what you typed). If no results are returned from the case-sensitive search, the tag search will then automatically re-search using a case-insensitive version (such as :search).
One of our most frequently asked questions is what is the difference between tags and search phrases. While they appear similar, they perform different functions.
Tags are like categories
- Categories and tags are used for organization and navigation.
- Tags are added to articles describe what the content is and what it relates to, and articles are put into categories for the same purpose.
- Both are visible to the reader.
- Neither are indexed for search but they display in the search results to provide additional context.
- Readers can click on tags or categories in search results to navigate to a list of related articles.
Tag example
You might have a tag called "troubleshooting" which tells you and the reader that (a) this article is about troubleshooting and (b) there are probably other articles which are about troubleshooting as well. By clicking on the tag, the reader can navigate to a list of all articles with the tag "troubleshooting".
You can manually pull up a list of all articles with a tag using the search. The syntax to return a list of articles with a tag is ":tag name". This tells the search to skip the normal search and return a list of all articles with the specified tag. Putting ":troubleshooting" into search would return all articles with the tag "troubleshooting".
Search phrases are like keywords
- Keywords and search phrases are tools to find things using a search engine.
- Both are part of the content and indexed for search.
- Neither keywords or search phrases are visible to the reader.
Search phrase example
Maybe you have an article on troubleshooting computer errors. If you have a Windows computer, you might be familiar with the "blue screen of death". If you are on a Mac, you might be familiar with the equivalent "spinning beachball of death" or one of its variations.
When someone types in one of the colorful variations of these problems, you want this article to come up but you may not want to add all these "of death" variations to your visible content. This is the perfect time to use search phrases.
You can add all the variations of the error as search phrases, which are hidden from the reader but get indexed for search. This way, the next time someone types "spinning pizza of death" or its acronym "SPOD" into search, your article on troubleshooting computer errors will appear.