Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
The rich_snippets_default_preprocessor function assumes its getting passed node entity data, which isn't always the case.
There is probably a better way to do this, but for now, I've added a return if the node object isn't present inside the resultset.
Comment | File | Size | Author |
---|---|---|---|
#3 | 1923904-3.patch | 2.24 KB | Nick_vh |
#1 | 1923904-search-nodes-only.patch | 731 bytes | japerry |
Comments
Comment #1
japerryBelow is a patch to check for the node object before printing node specific variables.
Comment #2
cpliakas CreditAttribution: cpliakas commentedGood catch. Thanks for posting a patch, and I definitely want to explore ways to be non-node friendly. Would love to hear some ideas on how to proceed.
Chris
Comment #3
Nick_vhI don't think we should block on only node centric code. For example : http://nickveenhof.be/search/site/thesis
The first result is a file, and it still can benefit from some of the rich snippets markup if support is added to it.
Attached is a patch I'm using
Comment #4
cpliakas CreditAttribution: cpliakas commentedI like this approach.
What happens when the apachesolr_get_index_key_map() returns FALSE? I want to make sure that use case is handled gracefully.
Thanks for the contribution,
Chris
Comment #5
Nick_vhsince you have isset() in all the code that relies on the output of apachesolr_get_index_key_map, it is safe to return false.
Comment #6
_randy CreditAttribution: _randy commentedNick_vh's approach and patch looks good. Our use case with commons suffers from issues with Rich Snippets and Tika file search results. The patch provided by Nich_vh eliminates the assumption of node based result sets.
Comment #7
cpliakas CreditAttribution: cpliakas commentedExcellent. Thanks for testing! Marking as RTBC.
Comment #8
cpliakas CreditAttribution: cpliakas commentedCommitted at http://drupalcode.org/project/rich_snippets.git/commit/fad5697.