Through the following error. it may break the functionality. if field_name is not defined
Notice: Undefined variable: field_name in apachesolr_search_nested_facet_items() (line 797 of /var/www/ifood/sites/all/modules/contrib/apachesolr/apachesolr_search.module).
# This patch file was generated by NetBeans IDE
# It uses platform neutral UTF-8 encoding and \n newlines.
--- Base (BASE)
+++ Locally Modified (Based On LOCAL)
@@ -783,6 +783,16 @@
$sortpre = 1000000 - $field['#count'];
}
+ $field_name = $field['#name'];
+ if (function_exists('taxonomy_get_term')) {
+ // Taxonomy filters in the query string use the tid field.
+ if ($field_name == 'tid') {
+ // Each taxonomy vocabulary in the Solr index uses its own field.
+ $term = taxonomy_get_term($field['#value']);
+ $field_name = 'im_vid_' . $term->vid;
+ }
+ }
+
// Only display children if the block enables it or the parent is clicked.
if ((isset($facet_show_children['apachesolr_search'][$field_name]) && $facet_show_children['apachesolr_search'][$field_name]) || (!empty($field['#children']) && $field['#active'] == TRUE)) {
$link['children'] = apachesolr_search_nested_facet_items($query, $field['#children'], $num_found, $sort);
Comments
Comment #1
pwolanin commentedThe above is a patch? Can you please explain more clearly the bug. Is it jsut a Notice, or actually affects functionality?
Comment #2
lalit774 commentedhi
i found notice only. but according to me the below condition never ever true. because $field_name not declare anywhere in the function.
i.e you can remove the below condition because its condition inner code never parse.
if ((isset($facet_show_children['apachesolr_search'][$field_name]) && $facet_show_children['apachesolr_search'][$field_name])
Comment #3
robinmofo commentedAs well as the notice, I also got a warning
Essentially, you are correct the $field_name is not declared and so I replaced my instances with $field['#name'].
I also updated the conditional $facet_show_children to
As I didn't see the need to check for both (isset) and (true).
My errors are now gone so I'm happy, I'd like to provide these as a patch (because I think I made some other local changes too for other notices? although I've been doing this a lot to contrib module recently as I evaluate them).
What's the status of the current dev version? Does it have any fixes in it?
Comment #4
nick_vhPlease provide a valid patch file so we can fix this :-)
Comment #5
robinmofo commentedOK, I'll assign it to myself so I don't forget (very busy atm)
Comment #6
robinmofo commentedPatched against latest 6.x-1.x-dev branch.. file attached.
Also removing myself as owner.
Comment #8
robinmofo commentedsorry, I used a third party program to create the patch.. I'll get it updated asap.
Comment #9
nick_vhClosing in favor of 6.x-3.x and because nobody seems to care (time of last response) or cannot reproduce. If you think this is still an issue in 6.x-3.x, feel free to re-open!