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

hankpalan.com’s picture

Issue summary: View changes
mlbrgl’s picture

Hi 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

  • mlbrgl committed 3d8fd83 on 7.x-1.x
    Issue #2529526 by mlbrgl: Add tid to code
    Added support for generic...
mlbrgl’s picture

Assigned: Unassigned » mlbrgl
Status: Active » Needs review

Generic entity-based indexes are now supported. Tests have been carried out on nodes, users and taxonomy terms but any entity should work.

hankpalan.com’s picture

I 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!

Grimreaper’s picture

Version: » 7.x-1.0

Hello,

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.