Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
I just noticed this error in my logs:
Notice: Trying to get property of non-object in apachesolr_search_apachesolr_facets() (line 847 of /DRUPAL7/sites/all/modules/contrib/apachesolr/apachesolr_search.module).
It's been occurring several times so figured it's worth reporting.
Comment | File | Size | Author |
---|---|---|---|
#20 | 1103602-valid-vocab-20.patch | 758 bytes | pwolanin |
Comments
Comment #1
jpmckinney CreditAttribution: jpmckinney commentedThat line number is a bit mysterious, as in the latest 7.x-1.x it is just a closing }. Can you point out what's on that line in your version of the module?
Comment #2
mgiffordIt's the if statement in this bit here:
Not sure why that would produce the error either, but looks like we are looking at different versions.
Comment #3
pwolanin CreditAttribution: pwolanin commentedOk, well that sounds like the vocabulary faield to load at all - do you have some deleted vocabularies?
try something like this change, though it won't fix the underlying problem:
Comment #4
jpmckinney CreditAttribution: jpmckinney commentedSame notice reported in #1101008: Installing Apache Solr Search Integration on Windows 7
Comment #5
mgiffordThat worked just fine. That patch removed the php notice from the reports
The error pops up with 404 issues:
So yes, I expect that the vocabulary field would be hard to find.
Comment #6
jpmckinney CreditAttribution: jpmckinney commentedNot sure why the field would be pointing to a non-existent vocabulary. Can you dsm($vocab['vocabulary']) and verify that a vocab exists with that vocab machine name?
Comment #7
jpmckinney CreditAttribution: jpmckinney commentedComment #8
mgiffordI did try to insert this but got a WSOD:
Not sure what I'm doing wrong here...
Comment #9
pwolanin CreditAttribution: pwolanin commenteddsm is not a core function, it's from devel module. Try:
Comment #10
mgiffordWell, it's getting closer. I had to use:
to avoid getting "Fatal error: Cannot use object of type stdClass as array" errors. However, I then got:
As a result. So I'm no wiser here as to the source of the problem. Perhaps it is blank vocabs, but not sure why that matters.
Comment #11
jpmckinney CreditAttribution: jpmckinney commentedDid you insert that code before or after:
The original
$vocab['vocabulary']
version should have been inserted before that line.Comment #12
mgiffordOk, I submitted the code after as per:
I added in the gettype() function as I was getting complaints about this being an object and not an array. In the 5 messages I got, 4 were objects & one was a boolean. There were no arrays.
This is consistent with the error.
Comment #13
pwolanin CreditAttribution: pwolanin commentedSo the boolean is a failed load it would seem
Comment #14
mgiffordSeems possible. So, does that help move this issue ahead?
Comment #15
legendfall CreditAttribution: legendfall commentedSo does that mean the problem solved? should I change code of apachesolr_search.module as described in #12?
anybody worked this out? thanks
Comment #16
jpmckinney CreditAttribution: jpmckinney commentedCan you instead put:
I want to know what $vocab is before it is set to taxonomy_vocabulary_machine_name_load.
Comment #17
legendfall CreditAttribution: legendfall commentedwhen I put:
$vocab = array_shift($vocabs);
if (user_access('administer search')) {
drupal_set_message('
');}
$vocab = taxonomy_vocabulary_machine_name_load($vocab['vocabulary']);
as suggested in #16, I got following:
• array | tags
• array | migrate_example_beer_styles
• array |
• array |
• array |
• array | dictionary
• array | forums
• array | book_size
• array | binding
• array | language
• array | nationalities
• array | book_category
• array | dictionary
• array | book_sale_period
• array | award_level
• array | award_category
• Notice: Undefined index: vocabulary in apachesolr_search_apachesolr_facets() (line 847 of C:\xampp\htdocs\drupal8\sites\all\modules\apachesolr\apachesolr_search.module).
• Notice: Undefined index: vocabulary in apachesolr_search_apachesolr_facets() (line 848 of C:\xampp\htdocs\drupal8\sites\all\modules\apachesolr\apachesolr_search.module).
• Notice: Trying to get property of non-object in apachesolr_search_apachesolr_facets() (line 850 of C:\xampp\htdocs\drupal8\sites\all\modules\apachesolr\apachesolr_search.module).
• Notice: Undefined index: vocabulary in apachesolr_search_apachesolr_facets() (line 847 of C:\xampp\htdocs\drupal8\sites\all\modules\apachesolr\apachesolr_search.module).
• Notice: Undefined index: vocabulary in apachesolr_search_apachesolr_facets() (line 848 of C:\xampp\htdocs\drupal8\sites\all\modules\apachesolr\apachesolr_search.module).
• Notice: Trying to get property of non-object in apachesolr_search_apachesolr_facets() (line 850 of C:\xampp\htdocs\drupal8\sites\all\modules\apachesolr\apachesolr_search.module).
• Notice: Undefined index: vocabulary in apachesolr_search_apachesolr_facets() (line 847 of C:\xampp\htdocs\drupal8\sites\all\modules\apachesolr\apachesolr_search.module).
• Notice: Undefined index: vocabulary in apachesolr_search_apachesolr_facets() (line 848 of C:\xampp\htdocs\drupal8\sites\all\modules\apachesolr\apachesolr_search.module).
• Notice: Trying to get property of non-object in apachesolr_search_apachesolr_facets() (line 850 of C:\xampp\htdocs\drupal8\sites\all\modules\apachesolr\apachesolr_search.module).
Comment #18
jpmckinney CreditAttribution: jpmckinney commentedGetting closer. Now, instead try:
Comment #19
pmorel CreditAttribution: pmorel commentedHaving the same error, the vocabulary triggering the notice is 'field_tags' to me. This appears in the field_config table along side the 'taxonomy_forums'.
They both have type='taxonomy_term_reference' and module='taxonomy'. However, only the field_tags vocabulary cannot be loaded. Is field_tags really a vocabulary? A least It does not appear in the taxonomy_vocabulary table (whereas forums does)
Hope this helps towards resolving the issue.
Comment #20
pwolanin CreditAttribution: pwolanin commentedThis looks like some kind of screwiness with deleted fields or a bad core upgrade.
Here's a bit of a brute-force fix.
Comment #21
pwolanin CreditAttribution: pwolanin commentedcommitted the above patch - but worth someone looking for the deeper cause.
Comment #22
jpmckinney CreditAttribution: jpmckinney commentedComment #23
legendfall CreditAttribution: legendfall commentedIn my case, with patch provided in #20, the Notice of "Trying to get property of non-object in apachesolr_search_apachesolr_facets() ..." is gone, but still remains following:
•Notice: Undefined index: vocabulary in apachesolr_search_apachesolr_facets() (line 845 of ...\sites\all\modules\apachesolr\apachesolr_search.module).
Comment #24
legendfall CreditAttribution: legendfall commentedHi all, in order to find source of problem, I started a new installation of drupal 7 on another computer, and now located where this problem comes from.
1. Apache Solr Search works fine with required modules enabled, both indexing and searching just nice.
2. For importing external data to Drupal 7, I chose Migrate module and have it installed in my drupal, there are four pieces within this module: Migrate, Migrate Example, Migrate UI and recently added migrate-example-baseball. In beginning I enabled all four pieces, imported couple example data provided in Migrate Example and reindexed the Apache Solr,following notice was given:
•Notice: Undefined index: vocabulary in apachesolr_search_apachesolr_facets() (line 845 of ...\sites\all\modules\apachesolr\apachesolr_search.module).
then I uninstalled Migate Example and tried Solr search again, works fine again. then I tried to import data in migate-example-baseball using DRUSH command line, reindexed imported data and search in Drupal, its doing just good!
3. Now back to original computer and uninstall Migrate Example, search with Solr, warning message gone.
4. therefore I believe there is something wrong with Migrate Example of Migrate module.
ps:
system configuration:
windows 7
xampp
tomcat 7
apache solr 1.4.1
drupal 7 (drupal-7.x-dev, apachesolr-7.x-1.0-beta5,migrate-7.x-2.0)
Comment #25
pwolanin CreditAttribution: pwolanin commentedall warranties are void if you try to run on Windows...
In any case, I don't see how your comment is related to this issue.
Comment #26
jpmckinney CreditAttribution: jpmckinney commentedCode no longer exists due to shift to facetapi.