Remove limit of predictive search API results JQuery Ajax

Solved
Highlighted
Explorer
88 7 20

Hey shopify freaks!

I wonder if it's possible to remove the limit of 10 results of the JQuery Predictive search (with GET search/suggest.json) somehow. Or maybe to do another JQuery search that delivers the same search results, but unlimited?

Maybe you guys have a smart idea if I explain:

If a customer starts to type an expression in my search bar, and I show him/her maybe 5 or 10 results with the predictive search, it would be nice to have a link above or below the results, for example "Show all 53 results". But at the moment the search results of my standard search page (which is still the shopify standard search, not the predictive one) doesn't even deliver the same results. And this is the page where the user is landing when clicking on the search button instead of a product suggestion . So this is not consistant, and also the predictive search is doing a way better job than the standard search.

Is there any way to align these two searches? 

It's weird if the user has some good results, is clicking on the search button, and doesn't see the results he saw before.

It's working in debut theme where predictive search is implemented, but I put it in manually.

I'd appreciate any ideas and input!

Thank you!

0 Likes
Highlighted
Explorer
88 7 20

I guess the title should have been "How to change the pagination search_url :)

I just compared the search results of debut theme with my minimal theme:

https://menschenskinder-shop.de/search?options%5Bprefix%5D=last&page=1&q=kreis
https://menschenskinder-shop.de/search?&page=1&q=kreis

So what I need to do, is to change my search_url by inserting "options%5Bprefix%5D=last" after "search?".

In my search-bar.liquid the code is

  <form action="{{ routes.search_url }}" method="get" class="input-group search-bar" role="search">
    {% comment %}<input type="hidden" name="type" value="product">{% endcomment %}
    <input type="search" name="q" value="{{ search.terms | escape }}" placeholder="{{ 'general.search.placeholder' | t }}" class="input-group-field" aria-label="{{ 'general.search.placeholder' | t }}" placeholder="{{ 'general.search.placeholder' | t }}">
    <span class="input-group-btn">
    </span>
  </form>

I need to find out how I can change the search_url.

Maybe somebody can help me here? I can't find "q=" when I search for it in my templates, and I'm a beginner...

Thank you!!!

0 Likes
Highlighted
Explorer
88 7 20

This is an accepted solution.

How I love shopify!!! :)

The answer is already in

https://shopify.dev/tutorials/customize-theme-edit-storefront-search-results

It's about searching with the last term, so I added this according to the shopify tutorial, which is resulting in the link that I need:

<input type="hidden" name="options[prefix]" value="last" />
1 Like