When a customer types “glock 19” into your website’s search box, they want a Glock 19. They don’t want a holster for one, a magazine extension, or 1,451 loosely related products with the pistol somewhere on page three. That sounds obvious, but it’s exactly where the search our stores relied on kept falling down, so we built our own.

The new MFS product search is one index behind the search box on your website, the full search results page, the product lookup at the register and the product list in your admin. This post covers both halves of the work: the engineering decisions that make the results better, and the new search panel that helps your customers find what they want faster.

Where the old search fell short

The search plugin our stores used was built on MySQL’s full-text search. That works well for blog posts and badly for gun names, because by default it ignores any word shorter than three characters, and the plugin rewrote punctuation before indexing it.

Look at what that does to real searches. In “glock 19” the “19” is too short to index, so the search quietly became “glock”. On our test store that returned 1,451 products, and holsters came first. “12ga”, “.22 lr” and short model numbers failed the same way. In a gun shop’s catalog these aren’t edge cases, because model numbers and calibers are how most of your customers search.

The register had a different problem. The point-of-sale product search didn’t use that plugin at all. It searched product details row by row, so on an 85,000-product catalog a lookup took 1.6 seconds, where an indexed lookup on the same catalog takes 27 milliseconds. That’s the difference between a cashier waiting on the screen and the result already being there.

Some stores ended up paying for a separate hosted search service on top of all that, just to get a usable search panel. We thought that should be part of the platform.

Teaching the index how gun names are written

The new index keeps one row per product, with variations rolled into their parent, so a pistol offered in three finishes shows up once. Each row holds the identifiers (SKU, UPC, GTIN and manufacturer part number), the title, brand, model, caliber and selected attributes, with the description kept in a separate, lower-priority field. The index updates itself as products are added, edited or change stock. A full rebuild is built off to the side and swapped in all at once, so customers never search a half-finished index.

The bigger change is how text gets broken into searchable pieces. Where the database supports it, we index text in two-character pieces instead of whole words, so “19”, “9mm” and “p365” are all findable. Not every host’s database supports that, so the index checks what the database can do and falls back to prefix matching for short terms when it has to.

The same cleanup runs on your catalog and on the customer’s search, so the two always meet in the middle:

  • Hyphens work both ways. “ar-15” and “ar15” find the same rifles.
  • Decimals survive. “.22”, “5.56” and “6.5” stay intact, and “5.56” won’t match “556” or “5.45”.
  • Ampersands are understood. “s&w”, “smith & wesson”, “smith and wesson” and “smith wesson” all find Smith & Wesson, and “m&p” finds the M&P line.
  • Synonyms are yours to set. Each store can list equivalents like “12ga, 12 gauge” or “9mm, 9x19, 9mm luger”, and a search for any of them finds all of them.

Putting the right product first

Finding the right products is half the job. Putting them in the right order is the other half, and it’s where we spent the most time.

Every match first lands in a tier. An exact SKU, UPC, GTIN or part number beats everything, so scanning a barcode or pasting a part number puts that product on top. Next come products whose title contains every word of the search, then products that match in their other indexed details, and last, matches found only in descriptions.

Inside a tier, results are scored by what the customer is most likely after:

  1. The kind of product they want. A search with no product-type word lifts firearms and ammunition. Adding “pistol” or “rifle” lifts firearms, “ammo” lifts ammunition, and an accessory word like “holster”, “magazine”, “barrel” or “scope” sinks firearms instead. That’s how “p365” shows pistols and “p365 magazine” shows magazines, even though plenty of P365 listings say “with 2 magazines” in the title.
  2. What the title is about. A title that names the search only after “for”, “fits” or “compatible with” is describing something else, so a “Glock 19 with Holosun 507C” listing doesn’t outrank the 507C itself when someone searches for the optic.
  3. Who made it. When the brand is part of the search, the manufacturer’s own product ranks above third-party parts made for it.
  4. Whether you can sell it today. In-stock items come next, then the closest wording, so “p365” puts the P365 ahead of the P365XL. When everything else is equal, products on your own shelves rank ahead of distributor stock.

Each signal outweighs everything below it combined, so a lower one can never outvote a higher one, and the ranking stays predictable as we tune it.

We tested this with 73 real searches against a copy of a live store’s catalog of about 55,000 products, comparing the first version of the new index with the version that has these ranking rules. Here’s how many of the top 24 results were firearms for some everyday firearm searches:

SearchFirearms in top 24, beforeAfter
glock324
glock 191224
sig p365024
cz p10024
kimber424
ruger 10/221024
beretta 921124
ar-15024
winchester 12 gauge1024

The spelling rules show up even more plainly. Searches like “m&p”, “s&w shield” and “ruger mark iv” used to come back empty, and now each one finds the right firearms and puts them first. The accessory rule works in the other direction, so “glock 19 barrel” now shows parts and accessories all the way down instead of mixing pistols in.

Fast, and safe to lean on

Speed matters most while someone is typing. In the same 73-search test, a typical search took about 80 milliseconds and the slowest took under half a second, so results keep up with the customer’s typing. To keep it that way under pressure, every search goes through the same limits. Very long or pasted searches are trimmed, only the first six meaningful words count, and each visitor gets a per-minute allowance, so a bot hammering the search box can’t slow the store down for everyone else.

Search also can’t take the store down with it. If the index is ever unavailable, say mid-upgrade or because of a database problem, the website, results page and register fall back to standard WooCommerce search automatically, and the admin shows a notice explaining how to rebuild. Customers get ordinary search for a few minutes instead of an error.

And it only shows what it should. Public searches never see draft, private or hidden products, and if your store hides out-of-stock items, search checks live stock before showing a card. Serial numbers are searchable by staff at the register and in the admin, never from the website.

What your customers see

All of that sits behind a new search panel. It attaches to the search box your theme already has, so there’s no redesign and nothing to move, and it can be set to match your store’s accent color.

Results while they type

When a customer clicks into search, the panel opens with a hint to type a model, a caliber or a SKU. Results appear a moment after they pause typing. Each card shows the brand, title, price and a stock badge that reads In stock, Out of stock, or In store for items on your own shelves rather than at a distributor. Simple in-stock products get an Add to cart button right on the card, so a customer who knows what they want can grab a box of ammo without leaving the page they’re on.

Search panel showing results for glock 19, with a filter rail of categories and brands on the left and a grid of Glock 19 pistols with prices, In stock badges and Add to cart buttons.
A search for “glock 19” on a live MFS store. Glock 19 pistols fill the first rows, and the filters on the left are built from these 370 results.

Filters that follow the search

Beside the results is a filter rail for category, brand, caliber, availability and price. Its options come from the current results, so a search for “glock” offers the calibers and categories Glock products actually come in, not every caliber in your catalog. Customers can pick more than one value in a filter, like 9mm and .380 ACP, and the counts stay accurate as they do. Active filters show as chips that come off with one click.

Search panel for smith & wesson narrowed to .380 ACP and in-stock items, with removable filter chips above a grid of Smith & Wesson pistols.
A “smith & wesson” search narrowed to .380 ACP and in-stock items. Each filter shows as a chip at the top, and the other calibers stay on offer with their counts.

On a phone, the rail folds behind a Filters button so the results get the whole screen.

Search panel on a phone showing glock 19 results in a single column, with a collapsed Filters button above them.
On a phone, the filters fold behind one button.

No dead ends

Pressing Enter or choosing See all results opens the full results page, ranked by the same engine and carrying the same filters, so the page never disagrees with the panel. If a search finds nothing, the panel suggests other searches to try, along with categories from what the customer was just looking at, so they’re never left at a blank screen. If something goes wrong, the panel says so and points the customer to the full results page, which keeps working.

Search panel showing no matches for glock 999, with suggested searches and a list of categories to browse.
Instead of a blank screen, a search with no matches offers related searches and categories.

The panel works fully from the keyboard, with the arrow keys to move through results, Enter to open one and Escape to close. It also announces results to screen readers and respects reduced-motion settings.

The same search behind the counter

The register and the admin use the same index, so staff get the same spelling rules and ranking as your customers. A barcode scan or typed SKU is an exact match and goes straight to the top, ahead of an unrelated product whose internal ID happens to be the same number, and staff can also look a firearm up by serial number. In the admin, the Products list and the product pickers search the same way, while order and customer searches read straight from your WooCommerce records, including the product names and serials on old orders whose products have since been deleted.

Behind the scenes, each site now has one owner for product search. Switching a store over turns the old search plugin off cleanly and keeps its saved search boxes and widgets working, and the store can be switched back to standard search from the same settings screen if it ever needs to be.

Rolling it out

We’re moving MFS Exchange stores to the new search one at a time, checking each store’s search boxes, widgets and price displays as we go. If you’d like to know when your store moves over, or want to see the panel on your own catalog first, book a time with us.

← All News