algolia / firestore-algolia-search

Apache License 2.0
112 stars 35 forks source link

Every Query performed on Algolia counts up towards the read usage count of Cloud Firestore #68

Closed nicolopadovan closed 3 years ago

nicolopadovan commented 3 years ago

As far as I understand, the extensions should only bridge new data to Algolia, which stores the received data in records and sends those back to the user whenever a query is performed. However, I have noticed that whenever I perform a query on my client (iOS in this case) the read usage of my Cloud Firestore increases by 1 for every hit of the query (which results in an enormous quantity of reads). Is this an intentional behavior? Thanks.

Haroenv commented 3 years ago

do you mean an algolia query or firebase query? how are you searching?

nicolopadovan commented 3 years ago

do you mean an algolia query or firebase query? how are you searching?

I mean Algolia query, and I’m currently using Instasearch to perform queries.

Haroenv commented 3 years ago

there's no logic to do a firebase query on every search query, is it possible you are doing that code manually in your frontend?

nicolopadovan commented 3 years ago

there's no logic to do a firebase query on every search query, is it possible you are doing that code manually in your frontend?

In fact, I thought so: but by removing the extension, the usage stops increasing, while I can still query through the already present records. As soon as I link the extension again, however, the usage starts increasing again. I am using infinite scrolling, if this info can be helpful at all.

Haroenv commented 3 years ago

Sorry, I'm not sure how the two can be related. Do you maybe mean that every time you make a change in the firebase data it will incur a read of that data, as it needs to be updated in algolia?

nicolopadovan commented 3 years ago

Sorry, I'm not sure how the two can be related. Do you maybe mean that every time you make a change in the firebase data it will incur a read of that data, as it needs to be updated in algolia?

No, I am not editing the Firestore database at all while querying. Also, I noticed that even after I removed the extension the problem persists, but I am absolutely sure that I am not reading the data from my client (there isn't any code at all that reads the database in my whole app). Whenever I query data from Algolia, the FIrestore usage increases, and it's not related to my client or to my own functions (there isn't any).

Haroenv commented 3 years ago

search doesn't pass through firebase, so I don't know what can explain this. Do you have the code somewhere that it can be tried out (you can erase the credentials)

nicolopadovan commented 3 years ago

search doesn't pass through firebase, so I don't know what can explain this. Do you have the code somewhere that it can be tried out (you can erase the credentials)

Here it is: https://github.com/nicolopadovan/PublicRepo/tree/dev

I moved all the algolia-related data to this project, which doesn't even import Firebase at all, and I tried using it with my API key etc, and the Firestore usage still increased.

To use it, just download it and then run pod install in its directory from the terminal.

Haroenv commented 3 years ago

cc @VladislavFitz it's iOS

smomin commented 3 years ago

hello @nicolopadovan, are you still encountering the extra reads on your firestore db?

nicolopadovan commented 3 years ago

hello @nicolopadovan, are you still encountering the extra reads on your firestore db?

Hello @smomin Finally, after basically rebooting everything (intended as deleting and re-creating the projects both on Algolia and Firebase and then bridging them together), I am not getting extra reads anymore. I don't know what could have caused the issue, but luckily it appears to be gone.