search.results_count shows products even when all products deleted from cms

New Member
2 0 0

I'm having an issue with what appears to be a search indexing problem.

I have a search page with the following code:

 
{% paginate search.results by 20 %}
    <script>console.log({{search.results_count | json}});</script>
    <script>console.log({{search.results | json}});</script>
{% endpaginate %}
If I perform a search such as: myshopify.com/search?q=foo&type=product
 

The search.results_count will show a non-zero number, but search.results will be an empty array.

 

The number that search.results_count returns depends on the query, and this seems to match what used to be in the cms for products. I have since deleted all products, hence no actual products being returned, but it seems that the results_count number has not been updated / reindexed. This also affects pagination, so that if I ask for a limit of 10 results, it may only show 3 (back before I had deleted all the products).

 

Any ideas? Is there a way to force a reindex of the products for search?

0 Likes