0

I'm having the issue generating the indexing for comments with Search API. While configuring, I used the datasource comments and added following fields for indexing. comment_body, cid, comment_type, created, entity_type.

and this is the error I get.

An AJAX HTTP error occurred.
HTTP Result Code: 200
Debugging information follows.
Path: /batch?id=8926&op=do_nojs&op=do
StatusText: parsererror
ResponseText: Error: Call to a member function toArray() on null in rdf_comment_storage_load() (line 239 of /home/xxxxxxx/public_html/core/modules/rdf/rdf.module).

While further investigation, I found that the line # 239 has the following code.

$comment->rdf_data['date'] = rdf_rdfa_attributes($created_mapping, $comment->get('created')->first()->toArray());

Where, $comment->get('created')->first() returns NULL, $comment->get('created') is the object of type FieldItemList which has the empty list that we can see with $comment->get('created')->view()

I dont know if I'm doing something wrong with configuration (prety much this is the case) or there is the issue with code, as I'm new to this CMS. I realy appreciate your help in this regard.

Thanks in advance.

5
  • $comment->id() - get comment ID and check this comment via Drupal UI. Try resave it or delete.
    – Nikit
    Apr 28 at 11:32
  • $comment->id() returns 23 Apr 28 at 12:12
  • Find comment in Drupal admin interface /admin/content/comment, then Edit and save it (or delete).
    – Nikit
    Apr 28 at 23:39
  • Wow, its strange. I couldn't find the comment with id "23" in the admin interface. Apr 29 at 17:45
  • you need manually call removing code on this comment #23: $controller = \Drupal::entityTypeManager()->getStorage('comment'); $entities = $controller->loadMultiple([23]); $controller->delete($entities);
    – Nikit
    May 6 at 1:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.