algolia / algoliasearch-helper-flutter

⚡️ Building block to create instant-search applications with Flutter
https://www.algolia.com/doc/guides/building-search-ui/what-is-instantsearch/flutter/
Other
22 stars 15 forks source link

Personalization? #39

Closed Patrick386 closed 1 year ago

Patrick386 commented 1 year ago

I do not want to import data registered by other users. What settings do I need for personalization?

 final HitsSearcher _addressBookSearcher = HitsSearcher.create(
      applicationID: AlgoliaCredentials.applicationID,
      apiKey: AlgoliaCredentials.apiKey,
      state:  const SearchState(
          indexName: AlgoliaCredentials.addressBookIndex,
          query: '',
         userToken: <<<<<<<< ?
      ));

I passed userToken but it doesn't work.

aallam commented 1 year ago

Hi @Patrick386, can you please clarify what you mean by "import data registered by other users"? Could you please explain or give an example of the behavior you are trying to achieve?

Patrick386 commented 1 year ago

HitsSearcher

The 'Products collection' stores product data for multiple users. The administrator must be able to read data from all users, and the Users should be able to read only the data they have registered.

Is it possible to implement it using HitsSearcher?

스크린샷 2022-10-25 오후 8 10 45
aallam commented 1 year ago

Hi again! Yes, it's possible, and it corresponds to personalized catalogs. As mentioned here, you will need the following steps:

  1. When users start searching, your Flutter app requests a secured API key from your server. Your server creates a secured API key with a pre-applied filter and returns it to your Flutter app.
  2. Your Flutter app uses the secured API key for searching with your HitsSearcher (as apiKey)
Patrick386 commented 1 year ago

I executed it according to your explanation and the results are as follows. First, the secured API key was generated and delivered to the user using Cloud function. I made sure that only my data was retrieved, and it worked very well. Thank you.

*Question I want to see the revised list immediately once I modify the item on the product list page. How can I make it work?

aallam commented 1 year ago

Hi, can you please explain more in detail the workflow? what do you mean by "modify the item on the product list page"?

Patrick386 commented 1 year ago

Hi, can you please explain more in detail the workflow? what do you mean by "modify the item on the product list page"?

Hi, The question is not related to this package, I solved the problem. The package works very well. thank you