As I continue to build my blog search engine, I have been asking myself “given my search engine is for my website, what features can I build that would be most helpful to me?”
I have been thinking a lot about search filters since I wrote my blog post on how helpful I find Slack’s search filters. I now think of search filters as an integral part of an effective search engine.
Returning relevant documents is the basis for a good search engine. The more relevant documents are on the first search page, the easier it is to find for what you are looking. Adding search filters on top of a relevant ranking algorithm gives you the ability to refine your search to find an exact document. Filters aid in finding documents that have certain attributes, or match one or more criteria.
I have been thinking: what search filters would be useful for me on my website?
One essential “filter” is the ability to search for exact words and phrases. For example, given the search query “the 1”, I wanted to find all documents that contain that exact phrase. This syntax is represented with quotation marks, like so:
“coffee in production”
The above query would search for all documents that contain the exact phrase “coffee in production”.
I then added filters that look for whether a page contains various types of content, like a table, a quote, and a link. Documents can be queried with the has:
prefix to check whether a document contains HTML tags associated with different content types.
The has:
prefixes available include:
has:footnote
has:table
has:quote
has:link
One interesting use of this is that I am able to see how often I use different markup patterns. For example, I had the impression that I don’t use links often, but it turns out that I have used links in over 600 articles (60%+ of my total blog posts).
has:
filters, by definition, filter the search space. Thus “coffee has:footnote” will only return documents that contain coffee and have a footnote.
I also added a has:
filter that checks if any images in a document are missing alt text:
has:noalt
I wondered if any blog posts had no alt text in images, and it looks like there are five images for which I need to write alt text. I will work on that!
I can combine filters to find specific articles, too, such as:
“web component” has:footnote
This query searches for all documents that contain the literal phrase “web component” and that have a footnote.
With each filter I add, I can narrow the search space, allowing me to more effectively find specific pages. I am excited to use these filters to help me find blog posts faster.