algolia / firestore-algolia-search

Apache License 2.0
112 stars 35 forks source link

Skip certain documents from being indexed #98

Closed garyodonoghue closed 2 years ago

garyodonoghue commented 2 years ago

Is there a way to skip/ignore particular document updates, i.e. filtering. For example if i have a collection of documents, each document containing a 'type' property, and I'm only interested in document updates where type == 'sport', how could i achieve this?

I thought of using the transform function to check the 'type' and return an empty response if it's not a value im concerned with, e.g. 'sport' in this example, but looking at the code here, I'm not sure that would be the correct approach.

Any suggestions appreciated, thanks

smomin commented 2 years ago

Hey @garyodonoghue

At this time, there is no way to skip documents, but I will consider this feature. The only approach is to set up filters during query time to filter out results based on attribute. You can look at this issue if this helps, #57.

smomin commented 2 years ago

Closing this issue for now.

omarsourour commented 2 years ago

@smomin Doesn't this PR #58 handle this issue? It seems to me from there that if I add a transform function that returns a null value, the index of the document will not be created.

i14h commented 2 years ago

Yes I think @smomin when you wrote the transform function you allowed a way to skip the entry being indexed, no?

smomin commented 2 years ago

Hey Omar, this PR was not merged. You can use the Algolia rules to filter out record based on a record property.

Sent from my iPhone

On Apr 27, 2022, at 4:57 PM, Omar E. Sourour @.***> wrote:

 @smomin Doesn't this PR #58 handle this issue? It seems to me from there that if I add a transform function that returns a null value, the index of the document will not be created.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.

smomin commented 2 years ago

No, I initially was going to merge this but then back away from doing it. I will take a look at it again.

Sent from my iPhone

On Apr 27, 2022, at 5:30 PM, Iman Rahmatizadeh @.***> wrote:

 Yes I think @smomin when you wrote the transform function you allowed a way to skip the entry being indexed, no?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.

omarsourour commented 2 years ago

Hello @smomin .. following up on this issue. Are there any updates regarding this?