-
Notifications
You must be signed in to change notification settings - Fork 26
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
Algolia index objectID is undefined #13
Comments
What is the name of the Primary Key field? |
I rolled back to how I had it configured when is was working for me (using a json config file). Basically, from what I now understand, the extension determines the primary key of the configured collection, and passes that value to Algolia as the objectID. This no longer happens. I wonder if something changed in the latest versions of Directus that changes how you determine the primary key for a collection. Maybe this line on create-indexer.js (line 69) no longer works?
In my use case, the primary key of the collection I'm trying to index is "id" |
Doesn't looks as there, at least with my tests it get correct primary key name, and pass correctly to the request. I also make different tests with algolia with different primary key names, and all seems to works for me, so cannot reproduce. Anyway, I'll continue to dig on it. |
Thanks for looking into it. Maybe there's something wrong in my configuration? Here is my config where I have a collection named "naics_2017_examples_en", and it has text fields "example" and "exceptions". The "naics" field is a o2m relationship field (and populates the index with the foreign key):
.... and here is the Algolia index. This one index entry gets overwritten for every item in the collection when I run "npx directus extension:searchsync index" (the exceptions field is supposed to be blank in this example):
|
I think it should be fixed now. The issue indeed was with the missing id field passing to algolia indexer when using filter fields. Thanks for all the report! |
Thanks so much for your help! |
When running the CLI command to reindex, the first record in the Algolia index is being updated over and over again for every Item in the Collection. I think it's because the ObjectID is set as "undefined", so Algolia is finding an existing record with that ObjectID and updating it, rather than adding a new record.
I was originally just configuring search-sync using a json file, passing just Item fields. In this case, I think Algolia was auto-generating the ObjectID. Since it was always "undefined", I tried using a js-based config file so I could pass the item.id as the Algolia ObjectID - no difference.
SearchSync v1.0.2
Directus 9.2.1
The text was updated successfully, but these errors were encountered: