algolia / algoliasearch-helper-js

Helper for implementing advanced search features with Algolia
https://instantsearchjs.netlify.app/algoliasearch-helper-js/
MIT License
174 stars 46 forks source link

Implementing backend search with Angular.js #884

Closed cmgchess closed 2 years ago

cmgchess commented 2 years ago

Hello 👋

I found out Instantsearch.js supports backend search here Since I'm using Angular.js and Instantsearch doesn't support Angular.js I would like to know if it is possible to perform backend search by defining a custom search client in the helper library with Angular.js

Thanks.

Haroenv commented 2 years ago

Hi @cmgchess, do you mean Angular.js, the framework that has reached EOL?

Any way, you can pass a different value than the algoliasearch client in the helper too, following pretty much the same guide as https://www.algolia.com/doc/guides/building-search-ui/going-further/backend-search/in-depth/backend-instantsearch/js/#searching-for-results

If you try this out and get stuck somewhere, feel free to comment with reproduction.

cmgchess commented 2 years ago

Hey @Haroenv thanks for the reply!

I tried this out a little but I can't seem to populate the components. I'm sending requests and getting back correct responses as seen from the networks tab.

I have attached codepen demo for reference https://codepen.io/cmgchess/pen/QWqYWVN

Haroenv commented 2 years ago

That's because the example you went with still used the callback-based version (only?) of the search client, not the promise version: https://codepen.io/Haroenv/pen/JjrxMaq

if I remember it correctly this was changed/fixed in newer versions of algoliasearch-helper

cmgchess commented 2 years ago

In https://codepen.io/Haroenv/pen/JjrxMaq when I pass the customSearchClient even with the callback it still doesn't seem to work 🤔

cmgchess commented 2 years ago

@Haroenv I checked with version 2.58.1 (latest version in cdnjs) and the callback version worked https://codepen.io/cmgchess/pen/oNGmqWE

Thanks for helping me out

Haroenv commented 2 years ago

Glad it's working for you!