Partial Word Search Feature

Tourist
12 1 0

Hi,

 

We'd like the search function on our website www.liquidispose.co.uk to match partial words. We understand that this may require some Java Script. Can anyone help?

 

Thanks, Lucy.

0 Likes
Shopify Partner
1867 182 761

Hello Lucy,

 

Searching for partial words is already supported if you use the asterisk character * e.g. cu* will find cup, cups etc.

 

If you want to make this the default behaviour when searching for terms, you will need Javascript (as you noted) to append that asterisk to the search term from the input field.

 

Would that be sufficient for your needs?

Liked this post? You might also like our fantastic upsell apps Candy Rack and Candy Cart or offer free gifts with Gift Box. All made with ❤️  and care by Digismoothie
0 Likes
Tourist
12 1 0

Hi Karl,

 

Thank you, yes, that's what we need!

 

Thanks, Lucy.

0 Likes
Shopify Partner
1867 182 761

Well quick & dirty would be to add it to the search form element directly on its onsubmit attribute as so

 

onsubmit="var s=$('input[type=search]');s.val(s.val()+'*')"

 

That should be on both search forms - the one in sidebar and search page.

 

Ideally though it would be much more neatly tucked away in the theme's theme.js.liquid.

 

Hope this helps!

Liked this post? You might also like our fantastic upsell apps Candy Rack and Candy Cart or offer free gifts with Gift Box. All made with ❤️  and care by Digismoothie
0 Likes
Tourist
12 1 0

This worked perfectly, thanks!

0 Likes
New Member
1 0 2

Hello, Karl! what about middle terms, e.g: The product code is R4800 and I'd like it to show on the results when I look for 800. Thanks

Shopify Partner
4 0 1

I am also looking for this functionality. Have you figured this out?

0 Likes
Tourist
26 0 0

I cannot figure out where my code is to edit. Can someone help? 

0 Likes
New Member
1 0 0

Hi, will this code help with improving the search engine?

One of my products is called KISSTU, Im searching for the word KISS and nothing is found.

 

Could you tell me please more precisely where to install the code? I have 0 idea about programing. Thanks a lot.

0 Likes
New Member
6 0 0

hi Karl,

Where do i add this code you mentioned?

Thanks

0 Likes