I get the following error when I run cron, but not when I index manually via the Index's status page.

PHP Fatal error:  Call to a member function value() on a non-object in sites/all/modules/contrib/search_api/search_api.module on line 1552
Drush command terminated abnormally due to an unrecoverable error.                                           [error]
Error: Call to a member function value() on a non-object in
sites/all/modules/contrib/search_api/search_api.module,
line 1552

I tried debugging but it was difficult because of the recursive nature of the function and debug_backtrace() only works if you pass it the DEBUG_BACKTRACE_IGNORE_ARGS option.

CommentFileSizeAuthor
#8 1471310--unset-field-8.patch2.72 KBdrunken monkey

Comments

reptilex’s picture

Priority: Normal » Critical

I have the same issue with the search_api_pages module. So it makes it completely useless. It worked before I updated everything to the new version, the version I was running was at least 8 months old but it worked.

jsacksick’s picture

Status: Active » Postponed (maintainer needs more info)

Can you provide more information ? Your index configuration .... What are you trying to do exactly ...

reptilex’s picture

I'm using the profile2 module to built an alumni database. I was using the search api to look in different fields of the profiles. I'm only using the dbsearch module. Since I updated I get the error message everytime I try to do a search. Indexing works fine. Of course my error does not come from the drush app but directly from the site. My index configuration is_

Status
    enabled (deaktivieren)
Maschinenlesbarer Name
    profilsuche_index
Item type
    Profil
Server
    DBSuchServer
Index options

    Cron batch size
        50 items per cron batch.
    Indexed fields
        Profil ID, Type, Beschriftung (1.0 x), Benutzer, Vorname (1.0 x), Nachname (1.0 x), Abschluss (1.0 x), Geburtsname (1.0 x), Geburtsdatum, Strasse und Hausnummer (1.0 x), PLZ (1.0 x), Stadt (1.0 x), Strasse und Hausnummer (priv) (1.0 x), PLZ (1.0 x), Stadt (1.0 x), Land, Tel. (fest priv.) (1.0 x), Tel (mobil priv.) (1.0 x), Fax (priv) (1.0 x), Strasse und Hausnummer (berufl.) (1.0 x), Stadt (berufl.) (1.0 x), Land (berufl.), Tel (berufl.) (1.0 x), E-Mail (berufl.) (1.0 x), Koordinaten (1.0 x), Website (priv.) (1.0 x), Website (berufl.) (1.0 x), Tel (perm.) (1.0 x), Titel (1.0 x), Anrede, Fax (berufl.) (1.0 x), PLZ (berufl.) (1.0 x), Arbeitgeber (1.0 x), Position (1.0 x), Kollegprojekt (1.0 x), Organisation (1.0 x), Land, Tutor (1.0 x), Institutionstyp, Organisation (1.0 x), Institutionstyp, Institutionstyp, Institutionstyp, Institutionstyp, Land, Land, Land, Land, Tutor (1.0 x), Tutor (1.0 x), Organisation (1.0 x), Organisation (1.0 x), Organisation (1.0 x), Tutor (1.0 x), Tutor (1.0 x), Land, Institutionstyp (berufl), Berlin, Brüssel, NRW, Genf, Washington, Frankfurt, Fachliche Schwerpunkte, Bisherige Berufserfahrung (1.0 x), Weitere Definition fachlicher Expertise (1.0 x), Jahrgang, Social Media (1.0 x), Item language, Benutzer » Name (1.0 x), Benutzer » E-Mail (1.0 x) 

Configuration status
    Benutzerdefiniert 

Some fields are checkboxes. But like I said, the indexing works fine. The problem appears when I try to do a search.

I get:
Fatal error: Call to a member function value() on a non-object in /website/sites/all/modules/search_api/search_api.module on line 1552
Do you need more info? Just let me know.

Anonymous’s picture

I have the same issue.

I do a sidewide search using search api pages and get the above error.

Setup:

  • search api page: 7.x-1.0-beta2
  • search api: 7.x-1.0
  • solr search: 7.x-1.0-rc1
  • search views: 7.x-1.0
  • search facets: 7.x-1.0
  • Search index uses solr server

Observations

  • The error occurs on the search api page when the search returns a result.
  • When using the search index in a search view, no error occurs. When using the same search index on seach page, error occurs.
Bevan’s picture

I think in my case an index was corrupt. Try disabling and re-enabling ALL of your drupal-solr indexes.

reptilex’s picture

I don't think that's it, at least not in my case. I deleted all indexes and created them anew.

reptilex’s picture

Mantainer needs more info? What more info do you require? Let me know and I will give it to you, gladly.

drunken monkey’s picture

Version: 7.x-1.0 » 7.x-1.x-dev
Status: Postponed (maintainer needs more info) » Needs review
StatusFileSize
new2.72 KB

I take it you have tried with the latest devs (Search API, Entity API and Profile2)? Then please see if the attached patch fixes your problem.

Anonymous’s picture

Status: Needs review » Reviewed & tested by the community

For some reason I also encountered this 'bug'. I'm using a custom entity and the error happened when indexing the basic 'title' field.
I am not using Profile2, but a custom module for a custom entity, and using

search_api 7.x-1.2
Entity API 7.x-1.0-rc3

Applying the patch from #8 fixed my issue!

reptilex’s picture

Status: Reviewed & tested by the community » Needs work

Sadly it did not fix mine. Now my search results are not shown. The line for the results says I have results, but nothing is shown. The good thing is I don't get any errors anymore. But no fix.

jaydub’s picture

Status: Needs work » Needs review

Ran into this error just now myself. I have a fresh instance with an empty index. I was able to get to about 45% indexed via some cron runs before hitting the error. I've applied the patch and so far no more errors and indexing is continuing.

jackbravo’s picture

Status: Needs review » Reviewed & tested by the community

Ok, this also fixed it for me. So that's three cases where this fixes the issue.

Still, there seems to be something weird going on. This is my backtrace:

PHP  12. install_run_tasks() /home/jackbravo/work/noesis/git-platform/drupal/includes/install.core.inc:77
PHP  13. install_run_task() /home/jackbravo/work/noesis/git-platform/drupal/includes/install.core.inc:339
PHP  14. install_finished() /home/jackbravo/work/noesis/git-platform/drupal/includes/install.core.inc:470
PHP  15. drupal_cron_run() /home/jackbravo/work/noesis/git-platform/drupal/includes/install.core.inc:1527
PHP  16. _search_api_indexing_queue_process() /home/jackbravo/work/noesis/git-platform/drupal/includes/common.inc:5243
PHP  17. search_api_index_specific_items() /home/jackbravo/work/noesis/git-platform/drupal/sites/all/modules/contrib/search_api/search_api.module:2143
PHP  18. SearchApiIndex->index() /home/jackbravo/work/noesis/git-platform/drupal/sites/all/modules/contrib/search_api/search_api.module:1040
PHP  19. search_api_extract_fields() /home/jackbravo/work/noesis/git-platform/drupal/sites/all/modules/contrib/search_api/includes/index_entity.inc:460
PHP  20. search_api_extract_fields() /home/jackbravo/work/noesis/git-platform/drupal/sites/all/modules/contrib/search_api/search_api.module:1645
Drush command terminated abnormally due to an unrecoverable error.                                                                          [error]
Error: Call to a member function value() on a non-object in
/home/jackbravo/work/noesis/git-platform/drupal/sites/all/modules/contrib/search_api/search_api.module, line 1616

The issue was launched on a $wrapper for a field of type "long text". The field was defined on some node types, but I didn't had any node type with that field on the database.

drunken monkey’s picture

Status: Reviewed & tested by the community » Fixed

Thanks for testing, and glad this worked for you.
Also, I'm very sorry I took so long to get back to you.
Anyways, committed.

@ reptilex: If you keep having problems with this, please open another issue and we'll try to get to the bottom of your problem.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.