I am not sure if this issue is for views_customfield or faceted_search so I am posting to both.
I am using views_customfield module and faceted_search module.
I have a main view that works with faceted_search to display results of a particular node type.
In that main view I am using a field from views_customfield module.
The field is Customfield: PHP Code.
In that field I am using the Drupal function "views_embed_view" to embed a view within a view for each result.
If I limit the main view to display 5 results per page, in which one of the results displayed on the first page display the embedded view, the results appear fine.
If I increase the main view to display 20 results per page, "Your search yielded no results" appears.
I have been debugging for days, and after commenting every single function in faceted_search.module and faceted_search_ui.module I determined that the difference when viewing 5 results vs 20 results is that:
5 results: in theme_faceted_search_ui_stage_result() function, $pager_total_items[0] == 5
20 results: in theme_faceted_search_ui_stage_result() function, $pager_total_items[0] == 0 <-- this should be 20?
Again, I'm not sure where the issue lies, but I will continue debugging to learn more. For now, I am posting about this issue in case I do discover a bug or a misconfiguration so that if anyone else has a similar issue, they can potentially find a resolution as well.
| Comment | File | Size | Author |
|---|---|---|---|
| #9 | warning-image.JPG | 75.63 KB | anandselvadurai |
Comments
Comment #1
mizerydearia commentedhttp://drupal.org/node/588878
I believe this may be related to faceted_search because when viewing the Views Preview, 20 or 40+ results per page appear fine, however, when viewing in combination with faceted_search results, 5 results per page appears fine, but 20 or 40+ results per page yields No results.
I discovered in sites/all/modules/views/includes/view.inc:
In class view extends views_db_object { }
In function _build($key) { }
line $pager_total_items[$this->pager['element']] = $this->total_rows;
The first/main view calculates the correct 'total' results that should be displayed on the main faceted_search results page.
The view within a view with views_customfield, for each view that is created, affects this value, depending on how many results there are.
I discovered that on my results page when only displaying 5 results per page, since the last result's view within a view does have results of its own, the results are ultimately displayed, views results and views within a view results.
If I changed to 4 results per page, I would have discovered that there were no results, because the 4th result's view within a view has 0 results.
Therefore, I must learn a workaround so that each view within a view result does not affect the main/initial/first/primary view's results, and therefore affect ultimately displaying them or not. Is anyone able to help me discover a solution for this issue?
Comment #2
mizerydearia commentedSpecific to this module, theme_facted_search_ui_stage_results() function can't rely on if ($pager_total_items[0] > 0) { } in the case that Views Custom Fields embeds a view within a view. How can I detect only the main view's pager_total_items[0] value?
Comment #3
mizerydearia commentedA work-around that seems to work for me:
Instead of relying on $pager_total_items[0] for the number of results, since the view within a view makes this value useless,
I modified a couple functions to pass on the correct results.
Comment #4
ailgm commentedI applied this and made one additional change:
in theme_faceted_search_ui_stage_results, I replaced:
$total = $pager_total_items[0];
with:
$total = $results_num;
and found that the correct count of results was shown.
The actual view didn't appear -- just the correct result count instead of the incorrect "Your search yielded no results" message.
Comment #5
ailgm commentedI made one more correction to them_faceted_seach_ui_stage_results, changing:
$to = min(($pager_page_array[0] + 1) * $limit, $pager_total_items[0]);
to:
$to = min(($pager_page_array[0] + 1) * $limit, $results_num);
And applied this change to settings.php: http://drupal.org/node/254069#comment-864166
That got the view appearing for me.
Comment #6
anandselvadurai commentedI have installed Feceted Search on my site, even i configured well but its not working correctly.
I don't get that kind faceted seach category on my admin->site building->blocks,...
And then my warning message is,
* warning: Parameter 1 to author_facet_faceted_search_init() expected to be a reference, value given in F:\xampp\htdocs\drupaltest\includes\module.inc on line 483.
* warning: Parameter 1 to content_type_facet_faceted_search_init() expected to be a reference, value given in F:\xampp\htdocs\drupaltest\includes\module.inc on line 483.
* warning: Parameter 1 to faceted_search_ui_faceted_search_init() expected to be a reference, value given in F:\xampp\htdocs\drupaltest\includes\module.inc on line 483.
Pls anyone send basic configuration of "Faceted search". And what path can i give in that "Base Path" and "Start Path"????????
Anybody help me, Thank You in advance...
Comment #7
ailgm commentedAnandselva -- you are experiencing a different problem, and so should post a new issue. By changing the title on this one, you are making it harder for someone to find this problem, when this is the problem they're having. So I've changed the title back to the original topic.
For a base path, make up a page name that you want to use to see the search, e.g. mysearchpage if you want to see it on www.mysite.com/mysearchpage
For a start page, follow the instructions beneath that field:
Path to go to when the current search is cleared. Popular options are the base path as entered above (shows a full search page), the base path followed by /results (shows all content using the same display style as search results), and (goes to your site's front page). Do not begin or end the start page's path with a /.
So you might want mysearchpage/results
Comment #8
anandselvadurai commentedThank You, Ailgm.
I already post this issue in new titile. I follow all those instructions but still i get that warnings.
Comment #9
anandselvadurai commentedThis is actual warnings shows in my site.. Please help i need to implement quickly.
Also send me the Path,
(i.e)
Base Path ::: -------------
Start Path :::--------------
I gave like this,
base path: "mysearch"
start path: "mysearch/result". Is it correct?
Send me reply.. Thank You in advance...