Search needs third character before returning results

Solved
Highlighted
Shopify Partner
7 0 0

Can anyone help me figure out why:

 

https://store.topdecksa.co.za/search?q=the%20first%20sl*&view=json

returns no results...

{ "results_count": 0, "results": [ ] }

 

But the following with one extra character (i):

 

https://store.topdecksa.co.za/search?q=the%20first%20sli*&view=json

returns the desired search results...

{ "results_count": 1, "results": [ { "title" : "The First Sliver", "url" : "\/products\/the-first-sliver", "thumbnail": "\/\/cdn.shopify.com\/s\/files\/1\/0896\/8958\/products\/TheFirstSliver_thumb.jpg?v=1558766138", "available": true } ] }

0 Likes

Success.

Shopify Staff
Shopify Staff
1012 67 133

Hey David, 

 

The way prefix search (*) works internally is that it will find the first 50 terms in the index that start with sl and sort them alphabetically. It will then add those to the query, searching on those specific terms. Since, in this case, sliver is not one of the first 50 terms in the index when sorted alphabetically, it will return no results.

 

When you search for sli*,  however, sliver does end up being one of the first 50 terms beginning with sli when sorted alphabetically in the index, so it gets added to the query and a matching result is found. 

 

We are currently working on creating a version of search that uses a different technique when trying to match results when searching this way, but it hasn't been fully implemented yet. Hopefully though in the very near future this isn't an issue that you will encounter again. 

 

TL:DR; this is a shortcoming of the way we match results when searching with '*' but we're currently working on improving that.

0 Likes
Shopify Partner
7 0 0

Thanks for the clear and prompt reply Josh.

Is there some way for me to find out when the new functionality is released? An issues tracker somewhere or perhaps it will be announced in a blog I can subscribe to?

0 Likes
Shopify Staff
Shopify Staff
1012 67 133

Happy to help, David! 

 

I can't guarantee this is the kind of change that would be announced publicly, but if it were to be, I would expect it to be announced in our changelog. 

 

There's a developer-specific changelog available here as well that would definitely be worth keeping an eye on. Not for this particular subject, but just in general. 

0 Likes