Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

This there a way to add recent searches to autocomplete #420

Open
mattc-poolwarehouse opened this issue Jun 14, 2024 · 3 comments
Open

This there a way to add recent searches to autocomplete #420

mattc-poolwarehouse opened this issue Jun 14, 2024 · 3 comments

Comments

@mattc-poolwarehouse
Copy link

I was wondering if there is a way to show the recent searches a user has made. There is documentation on the Algolia docs on how to do this, but I'm not sure how to implement this in the way that this plugin sets up autocomplete. They use the createLocalStorageRecentSearchesPlugin in the algolia library.

https://www.algolia.com/doc/ui-libraries/autocomplete/guides/adding-recent-searches/

Anyone else implemented this feature?

@tw2113
Copy link
Member

tw2113 commented Jun 14, 2024

Hi @mattc-poolwarehouse

TLDR: this is mostly just an informational reply about current status about what's shipped by default and in-the-works changes.

We fully admit that at the moment we still have the 0.38.x version of autocomplete as the default setup/template out of box, but haven't fully attempted to do an update yet to allow for choosing version 1.x.

The biggest hurdle is that we can't necessarily accurately target the search field any more since 1.x Autocomplete expects a container provided as such: <div id="autocomplete"></div> and they handle the rest. This requires users to intentionally create where that div goes, most likely replacing the search field that was originally there. Hopefully you can see how that'd be a small trouble spot for out of box functionality.

That said, we do have a branch of the plugin that is meant to offer the ability to choose what we call "legacy" vs "modern" in terms of intended UI changes.

You can see the autocomplete.php template that that would ship with, over at https://github.com/WebDevStudios/wp-search-with-algolia/blob/feature/272-autocomplete-upgrade/templates/autocomplete-modern.php

That said, just making use of that as a starter won't necessarily get you all the way through, as you'd still need to implement and load the newer Autocomplete libraries as well.

That said, I'm definitely curious how ready the branch is overall, outside of the div placement. Last I checked, I am using it on a personal site without much issue, but it also gets zero traffic outside of myself :D

Whole branch if curious https://github.com/WebDevStudios/wp-search-with-algolia/tree/feature/272-autocomplete-upgrade

@mattc-poolwarehouse
Copy link
Author

Michael, Thanks for the quick response. Looking at the autocomplete-modern.php template, it does look like the code in the link I sent. I'll try pulling that branch down to a test environment and playing with it. Thanks again!

@tw2113
Copy link
Member

tw2113 commented Jun 14, 2024

For what it's worth, you'll most likely need to run things like npm install and similar, as the repo here isn't immediately the same overall files as compared with what you get at https://wordpress.org/plugins/wp-search-with-algolia/.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants