Hi folks,
First time around here and I didn't find anything similar in other posts, so if it's not new, sorry. I was getting very frustrated because I got the "Your search yielded no results" message with FS all the time, although there were results with the core search module.
I looked a bit inside and it seems like there's a problem with the global vars $pager_total_items, $pager_total and $pager_page_array between the moment the function pager_query() is called in faceted_search.inc and the moment the function theme_faceted_search_ui_stage_results() is called in faceted_search_ui.inc [line 71 -> return theme('faceted_search_ui_search_page', $results, 'node'); ]. The globals get rewriten, probably by some other process or module (I don't know). The $pager_total_items variable returns always the same array: (0=>0). Thing is, I solved the problem creating new globals in the function load_results() in faceted_search.inc [line 1192] and passed those to the respective theme function. Now it works, but this is probably not the proper way to solve this and I don't know if this happens only in my drupal installation. Maybe someone has a better insight of what's wrong. I wouldn't like to hack around like this everytime I update FS, so I ask for your help...
So here's what I've done to solve it for now:
I changed function load_results() in faceted_search.inc [line 1192] into this:
function load_results($limit = 10) {
global $pager_page_array, $pager_total, $pager_total_items, $fs_pager_page_array, $fs_pager_total, $fs_pager_total_items;
$found_items = array();
if ($this->_results_count) {
$result = pager_query("SELECT * FROM ". $this->_results_table, $limit, 0, 'SELECT '. $this->_results_count);
$fs_pager_total = $pager_total;
$fs_pager_total_items = $pager_total_items;
$fs_pager_page_array = $pager_page_array;
while ($item = db_fetch_object($result)) {
$found_items[] = $item;
}
}
return $found_items;
}
and function theme_faceted_search_ui_stage_results() in faceted_search_ui.module [line 1416] into this
function theme_faceted_search_ui_stage_results($results, $style) {
global $fs_pager_total, $fs_pager_total_items, $fs_pager_page_array;
if ($fs_pager_total_items[0] > 0) {
$limit = $style->get_limit();
$from = $fs_pager_page_array[0] * $limit + 1;
$to = min(($fs_pager_page_array[0] + 1) * $limit, $fs_pager_total_items[0]);
$total = $fs_pager_total_items[0];
...
cheers,
rodrigo
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | faceted_search_no_results.patch | 1.73 KB | stacysimpson |
Comments
Comment #1
EvanDonovan commentedCould you write this up as a patch, maybe?
Comment #2
stacysimpson commentedWe were having the same problem and could not figure out what was going on. Our production and test sites have the same data/modules, but behave differently. A search phrase would display results on our test site, but not our production site. Although the message, "Your search yielded no results" displayed on our production site, the guided search block did show various hits.
The proposed changes seem to fix the issue and I rolled them into a patch.