Octopart Under the Hood: Suggested Categories
Pulse
Octopart Staff
Oct 10, 2017

It’s hard for a person to confuse Relays and Microcontrollers, so why should your parts search engine?  

Context is an important aspect of good part search and categories play a critical role in establishing context. We recently released our new part categories and we’ve been working extensively on improving our part categorization. Search interfaces often choose a less-than-ideal solution. Some leave you to navigate the whole category tree, possibly digging through many levels to narrow your search, even after you’ve typed specific search terms. Another possibility is forcing you to choose a category as a second step after entering search terms, which leaves you with a minimum of two steps to see results. We wanted a better way.

With that in mind, in our July update to parametric filters, we added a cool feature that zooms you directly to the most relevant category for every search and shows suggested refinements and filters. Since I love writing about how search works, let’s look at what’s going on behind the scenes with this new feature.

We’ll start with a popular search query on Octopart: relays.

Check out that row of category suggestions! It starts with the Relays category, which is most applicable to the search term, and then lists possible refinements like Power Relays and Signal Relays. Below that, we’ve got relevant parametric filters for relays, chosen by Octopart EEs. You can click the category suggestions to narrow your search and see more relevant parametric filters.

Identifying the most relevant category for a search query is similar to the part search problem, but with a twist. When searching for parts, the goal is to find parts that contain all of the terms in the search query. However, when we want to find a category that relates to a search query, the goal is to find a category that is completely contained in the query.

Let’s walk through an example:

Search termsCategory: RelaysCategory: Relays > Power RelaysSelected CategoryNotes
relayMatchNo MatchRelaysThe category Relays is entirely contained in the search term “relay,” while the category Power Relays is too specific.
power relaysMatchMatchPower RelaysCategory Power Relays is entirely contained in the search terms, as is the category Relays. The more specific category is selected.
omron power relay 10A DPDTMatchMatchPower RelaysAdding more terms narrows the search, but Power Relays is still the most specific category entirely contained in the search terms.
To accomplish this, we use the Elasticsearch Percolate feature, which allows executing many predefined searches in parallel, easily and quickly.

So that’s pretty cool, but what about component searches that don’t include category names? For example, atmega328 is another popular search:

Even though the phrase “Microcontroller” doesn’t exist in the search term, Octopart determined that the query is about Microcontrollers and shows parametric filters relevant to microcontrollers.

For searches like this we can’t rely on category name text matching, instead, we use the distribution of the parts in the result set across categories. Most results for “atmega328” are in the Microcontrollers category so we can infer that Microcontrollers is the most relevant category to that search.

How does our algorithm match the category to the part? Octopart categories are organized in a tree that’s up to three-levels deep. Microcontrollers live at level three: Integrated Circuits (ICs) > Embedded Processors and Controllers > Microcontrollers.

Our algorithm traverses the category tree starting from the broadest categories. At each level, a winning category is chosen based on the number of total parts and comparison of the number of parts in sibling categories. If there is a clear winner, the algorithm descends into the winning category and continues to identify a category most relevant to the search terms with a balance of broadness and specificity. The result is a category suggest that provide relevant parametric filters on the first try and offers you opportunities for further refinement of your search.  

This is one of many improvements we’re working on to make Octopart the best component search experience available. Together, each improvement adds up to make Octopart the most reliable, friendly, useful, and fast source for part information and search. Stay tuned for more improvements like this and let us know what you’d like to see in future updates by leaving a comment below or reaching out to us at contact@octopart.com.

Read More Articles