Skip to content
  • Hot
  • Top
  • New

You have ... votes left in this category for this week!

Add conditional prefix or pattern match check on search string to determine in postmeta should be searched

Dave Hilditch shared this feature

September 4, 2020

Super Speedy Search latest updates have made postmeta search even faster than before, about 3 seconds against a million products.

But – 3 seconds is still quite slow, and if you remove the meta search then the SQL query is blindingly fast – negligible load on your server.

It seems in the majority of cases, users are enabling the _SKU meta item to be searched and not really using meta search for anything else. Because of this, I think there may be a sort of cheat I can implement to speed search up further.

What I’m thinking is that many stores will have a prefix or a pattern of some kind for their SKUs –

* Maybe SKUs are always a minimum length?
* Presumably SKUs are always 1 word?
* Maybe SKUs have some kind of pattern – like they always start with WPI or something similar for your store?

What I’m thinking is that I could add a pattern test to the search string to check if postmeta should be searched at all, and if the pattern test fails then skip searching postmeta.

For example, you could configure: WPI* as the pattern for your metadata searches to be activated and then if a user searches for “Dell Monitor” it would skip checking postmeta. If a user searches for WPIX1023 then it *would* search postmeta.

The idea being that this would speed up product search massively for your users who are probably mostly not entering SKUs – I’m presuming again that this addition of SKU search is actually mostly for the benefit of your site admins?

Please provide as much info as possible to help here so I can make Super Speedy Search *even* faster than it already is!

1 Comment

  1. Rogerio P.
    October 6, 2020 @ 3:26 am

    Hi Dave

    Thanks for improving the search speed. Regarding the above, _SKU would be the only meta item which I enable for search. I have considered just adding the SKU to the end of the title so that I don’t have to enable the _SKU meta item. For our store, the SKU’s don’t have any pattern as we sell products from hundreds of different vendors and they all have their own patterns. I can often recognise the manufacturer of the product just by the format of their SKU. For example, the latest 10 products ordered on our site have the following SKU; EYV-00029 (Microsoft), WF40 (Yealink), 27X0135 (Lexmark), TS5160BK (Canon), ATA191-3PW-K9 (Cisco), MAC-A (Brateck), FZ-VSTM11U (Panasonic), R2000DB (Edifier), ROC-11-725-WE-AS (Roccatt), LDT12-C1M2KN (Brateck). If the user knows exactly what product they need then it’s much easier to search by SKU to find what they are looking for. I would think that this would be the case for technology products, rather than clothes or bespoke products.



Leave a Reply

Your email address will not be published. Required fields are marked *