Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
When adding a taxonomy term index to the Search API I get the following error:
SearchApiException: The 'objectID' attribute is required to use action=updateObject near line:1 column:113 inSearchApiAlgoliaService->indexItems() (line 168 of public_html/sites/all/modules/search_api_algolia/includes/service.inc).
Briefly looking in the code I only see mention of the 'nid' in reference to the objectID that algolia is needing. Would it be hard to add 'tid' to the code so I can use a taxonomy index?
Comments
Comment #1
hankpalan.com CreditAttribution: hankpalan.com commentedComment #2
mlbrgl CreditAttribution: mlbrgl as a volunteer commentedHi Hank,
At the moment, I have been working with node and user entities, but the module published on d.o is only focusing on node entities (and as you rightfully noticed, this choice is hardcoded). When I have to switch to user entities, I pretty much replace 'nid' with 'uid' for now, but this situation quickly shows its limit when you want to index both node and user entities on the same site. Making this more generic is definitely on my roadmap, as several people have been asking for it. If you have an immediate need for indexing taxonomy terms, I would suggest you play with replacing 'nid' with 'tid' on line 131. But please keep in mind this has not been tested.
Matthieu
Comment #4
mlbrgl CreditAttribution: mlbrgl as a volunteer commentedGeneric entity-based indexes are now supported. Tests have been carried out on nodes, users and taxonomy terms but any entity should work.
Comment #5
hankpalan.com CreditAttribution: hankpalan.com commentedI just updated the service.inc and it seems to be working correctly. I'll run it through a few things over the next week and get back to you with any problems.
Thanks for doing this!
Comment #6
GrimreaperHello,
Assigning a version to the issue to be able to filter it.
I can't select the 7.x-1.x-dev version as it seems to not be published.