Is there a way to change how search handles hyphens on the front end?

We’re having an issue where products which use hyphens in their name/product code wont appear in a search on our site unless a hyphen or space is used.

For example if we take this product: ROLAND TD-17KV2 V-DRUMS ELECTRONIC DRUM KIT

It will appear in a search for TD-17 or TD 17 (using hyphen or space)

It WONT appear in a search for TD17 (using no space)

Seems like most of our non-shopify competitors have this behaviour solved by default.

Is it possible to change this behaviour?

Or is there something I can do without manually tagging 1000’s of products?

Hi,

Hope following will help

Use a Search Enhancement App
Configure Shopify’s Built-in Search
Implement Custom javascript or script Code

function preprocessSearchQuery(query) {
  // Remove hyphens and spaces
  return query.replace(/[-\s]/g, '');
}

// Example usage
var originalQuery = 'TD17';
var processedQuery = preprocessSearchQuery(originalQuery);

Tag Products and Use Metafields
Analyze Search Data