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|
|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).