Getting a list of trending searches

I am presently working on a client site that is making use of Algolia search for displaying their products. One of the requirements is that when selecting the search input, but nothing has been typed yet, we show some trending queries.

I’m trying to find the best way to generate and make use of this type of information.

I know already there’s recent searches, but that’s for just the user doing the searching, and there’s also Suggested searches which its based on what the user has started to type in.

It’s this third type that I’m not quite sure of and my searching, ironically, isn’t bringing up any results that match.

Great question!

Our ‘Query Suggestions’ feature I believe will take care of this for you. While you can provide a query to base the suggestions on, you can also just submit an empty query. I found a Code Sandbox here that implements what I believe you are looking for:

This example takes the query suggestions and shows them in the order of highest popularity (most activity). We have some documentation here going over it in more detail.

Do you think this would work for your use case? We have trending models but they are only for items and facets.

If I’m understanding correctly, this would be similar to my “there’s also Suggested searches which its based on what the user has started to type in.” but instead would just submit an empty query and let Algolia return what it may?

If that’s the case, then I’ll roll with this and see how we feel with it.

Thanks @michael.king

Sounds good, let me know how it works for you! Thanks!

I have a feeling that I know the answer, but I want to confirm too.

Suggested Searches as documented above is not going to be compatible with Autocomplete version 0.38, correct? As that’s the version we still ship with in WP Search with Algolia which is providing our source libraries for this client project.

We would need to upgrade is my hunch.

I didn’t see any of our examples using that exact version, they all seemed newer. Here are a bunch of our examples for Autocomplete if you wanted to take a look and see what upgrades may be needed:

We went the route of upgrading the specific client and re-implement things. I believe we can consider this issue closed at the moment.