Installed apachesolr as per instructions. Running Drupal 6.12 on centos os with PHP 5.1.6. OG installed so enabled Apachesolr OG integration. I also have taxonomy_access and og_subgroups modules installed as well.
Enabled a bunch of filters.
I did a search for "test". Got the default Drupal search results screen. Then, I clicked on the "Search" tab. Got the white screen of death. The httpd server reports these errors:
[Sat May 16 14:18:59 2009] [error] [client 192.168.218.3] PHP Fatal error: Call to undefined function og_subgroups_get_eligable_groups() in includes/common.inc(1645) : eval()'d code on line 15, referer: http://mysite.com/admin/settings/apachesolr/index
[Sat May 16 14:23:13 2009] [error] [client 192.168.218.3] PHP Fatal error: Call to undefined function taxonomy_admin_term_edit() in /includes/common.inc(1645) : eval()'d code on line 2, referer: http://mysite.com/admin/settings/apachesolr/index
[Sat May 16 14:44:06 2009] [error] [client 192.168.218.3] PHP Fatal error: Cannot access empty property in modules/apachesolr/Zend/Json/Decoder.php on line 239, referer: http://mysite.com/search/node/test
So, I unchecked the following filters:
Apache Solr OG: Filter by Organic Group
Apache Solr Search: Filter by taxonomy ...
Re-indexed site. Re-ran cron.
Executed "test" search. Clicked on "Search" tab. No longer getting the errors. Search results come up as expected.
I would like to be able to use OG and taxonomy as search filters. Any suggestions for these? I find no reference to "taxonomy_access", "taxonomy_admin_term_edit" or "og_subgroups" when seaching apachesolr issues.
Comments
Comment #1
pwolanin commentedWell, the first error is likely due to some .inc file not being loaded when it's expected. Not sure what to do about that - probably a bug in og_subgroups
Comment #2
somebodysysop commentedFound one of the problems!
The site I am testing was upgraded from 5.x to 6.x. I had some nodes that were php code format. A couple of those were used for testing, and, yes, called og_subgroups_get_eligable_groups() and taxonomy_admin_term_edit(). Hence the errors I posted here.
So, the solution to a problem like this in apache solr is not to have php code format nodes that call functions that no longer exist.
However....
I enabled the OG Filter. I deleted and re-indexed the site.
Once the site is indexed, and a search for "test" is executed, this fatal error is returned:
I disable the OG filter, re-index site. Search for "test" works.
Any ideas on how I can fix this?
Comment #3
somebodysysop commentedComment #4
pwolanin commentedThe fatal error in Zend more mysterious - I have not really used the Zend code much other then a cursory initial test since I have PHP 5.2.
Do you have to re-index to make the error go away, or just turn off the module?
Comment #5
pwolanin commentedThe taxonomy module code is:
This is likely happening then when we call
$extra = node_invoke_nodeapi($node, 'update index');The invalid foreach says that $node->taxonomy is not an array - which it will not be for any node without taxonomy terms. To me this looks like a core bug.
indeed, here it is: http://drupal.org/node/225864
Comment #6
somebodysysop commentedre: #5:
Sorry. I researched and found the same thing, which is why I changed the issue title. I realized it wasn't an issue with apache solr. For others following this, I used the temporary resolution http://drupal.org/node/259632 until it's fixed in core.
re: #4:
If I uncheck Apache Solr OG: Filter by Organic Group, the problem goes away. Of course, so does the OG filter. Any guesses on the Zend error? Perhaps the index says a group is there that isn't? I don't mind plugging away on it, just don't have any clues right now.
Comment #7
pwolanin commentedThe title change was just due to cross-posting, didn't mean to change it.
Comment #8
pwolanin commentedIs this still a problem?
Comment #9
somebodysysop commentedYes, if OG Filter is checked I get this error:
Comment #10
pwolanin commentedIntersting - I think I applied the "facet missing" trick to the OG sub-module, but I'm not sure what the JSON response actually looks like for that.
Comment #11
robertdouglass commentedComment #12
somebodysysop commentedNow getting this error on a different site where I have NOT enabled OG filter. Upon testing, it appears to happen when I enable "Filter by content type". Any ideas on what causes this under these circumstances? Has anyone else seen this and resolved it somehow?
By the way, I've tried to enable the og filter on 3 different sites now (all converted from 5.x to 6.x) and pretty consistently get this error. This is the first time I've received it for a filter other than og.
Comment #13
somebodysysop commentedAny ideas whatsoever on this error when selecting "content type" filter?
UPDATE
It appears that I do:
This is a site converted from 5.x. For some reason, I had a series of nodes that had no content type at all (i.e., type field = ''). I deleted these nodes, and now the Apache Solr content type filter works.
However, the OG filter still does not work. But, this problem, and it's resolution, suggests to me that this is a content problem. But, what should I look for? I have 4 sites running now, including one which was created in 6.x. The OG filter does not work in any of them. In all sites, when the OG filter is enabled, I get the white screen of death on apache solr searches.
Anything at all I can try to look at?
Comment #14
pwolanin commentedSomeBodySysop: per above - try run the queries directly against Solr or logging the JSON response. This is almost certainly some difference in how PHP and the Zend class decode the JSON. It might be that you have to tweak the JSON class a little, or look around for an alternate JSON parser to try (search the back issue queue for one other option).
Comment #15
somebodysysop commentedNot sure I understand how this is done. What I did do:
1. Went to apache solr screen (i.e., mysite.com:8983/solr)
2. Selected admin screen for one of the sites
3. Set the site logging to "finest" level
4. Ran queries from apache solr admin screen for site as well as from the "Search" tab in Drupal.
I ran 3 queries:
test
name
group
test group
Here is what popped up on my Linux console screen:
This is what I found in /opt/apache-solr-nightly/drupal/logs:
I noted that I do get a xml response back in apache solr screen, but still white screen of death in Drupal. Is this info of any use, or am I supposed to be looking elsewhere?
Appreciate the response.
Comment #16
pwolanin commentedYou could take the queries above and put them directly into Solr to get the JSON output. If you add
&indent=1the JSON will be much more readable. As an alternative, you could hack drupal_http_request() and add a watchdog or file_put_contents() in order to get the response out.Comment #17
somebodysysop commentedOK, thanks for your help. I may have found something here, but you'll need to let me know for sure, and what I can do about it.
I entered:
I get back:
I'm guessing that my problem has to do with this:
"im_og_gid":{
"8":3,
"":2}},
Again, this is only a guess, but:
There are 5 search results. 3 belong to group id 8. 2 belong to no group (because they are groups themselves). Is it this empty group facet that could be causing the problem?
In Apache Solr OG configuration:
Is the group node "included" within a group along with that group's posts:
I selected "included" then "not included". I get the same exact results as above.
If the empty group facet is the problem, does that mean that the Apache Solr OG filter will only work on sites which only has group content? And, if that's not what it means, how do we address this problem of og filter searches returned with no groups?
Hope this makes sense!
Comment #18
pwolanin commentedI think you have to re-index to get a change to the included/not-included setting to have an effect.
Comment #19
somebodysysop commentedDeleted index, re-indexed with the same white screen of death error.
This is the query from the log:
And this is the resulting output:
Same thing. Think that's (empty im_og_gid field) is the problem? If so, won't it be a problem with virtually every site?
Comment #20
pwolanin commentedmost sites are on PHP 5.2, which has a built-in JSON decoding function that apparently behaves a little differnt.
If I pass your JSON above through PHP 5.2 json_decode I get for the facet count part:
Note that "" as a key in your JSON, gets turned into _empty_
Comment #21
somebodysysop commentedI'm currently running php 5.1.6.
It sounds like you are saying that my problem would be resolved by running under php 5.2?
If so, I'll try to see if I can upgrade.
Thank you very, very much for your help here.
Comment #22
somebodysysop commentedI updated to php 5.2, enabled OG filter, executed search. No more white screen of death. Whoo-hoo!
Again, many, many thanks for all your help on this issue.
Comment #23
pwolanin commentedYes, the Zend class is only used as a stop-gap for PHP 5.1, but still ti would be nice to know how to make it work right.
Comment #24
sixty4rpm commentedYes, I agree with the last comment -- I am not able to upgrade to 5.2, and I am in desperate need of a workaround for php 5.1 and Zend/Json/Decoder.php. Is there any sort of simple fix? We really need to filter by OG.
Comment #25
pwolanin commenteduntested, but try changing the Zend code like so:
Comment #26
sixty4rpm commentedIt's tested now! Thanks, works like a charm!
Comment #27
pwolanin commentedcross ref to ZF bug report: http://framework.zend.com/issues/browse/ZF-7586
Comment #28
pwolanin commentedwe should at least document this in the README
Comment #29
cfennell commentedThe PECL JSON extension operates in the same way as the Zend class, so perhaps a fix should be implemented higher up the food chain within solr-php-client, which is also where the failure actually occurs? With PECL JSON, you don't have much choice since you really can't modify it's source.
Transforming the _rawResponse variable w/in the constructor fixed the problem for me when using the PECL JSON extension.
//fix for PECL and Zend
$this->_rawResponse = str_replace('"":', '"_empty_":', $rawResponse);Would it make sense to file an issue w/solr-php-client? It seems like other projects outside of Drupal would have run into similar issues, but I haven't done much digging outside of drupal.org. Anyway, I don't have much need for the og filter just now, so I'm disabling it.
Comment #30
jpmckinney commentedI don't think it can be a bug if it has to do with Zend/PECL, etc.
Comment #31
pwolanin commentedPHP 5.1 should be dead now. I think I put the patch above into the version we ship w/ Acquia Drupal