Closed (fixed)
Project:
Search by Page
Version:
6.x-1.0
Component:
Main Search by Page module
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
3 Aug 2009 at 18:28 UTC
Updated:
28 Aug 2009 at 16:20 UTC
It seems that search by page only returns 10 search results, and it doesn't provide an option to paginate through any results beyond the first 10. Am I missing something, or is this a serious limitation of search by page?
Comments
Comment #1
j_shb commentedComment #2
jhodgdonPagination of Search by Page results works fine for me...
A few notes that may help you troubleshoot your site:
- Search by Page uses core Search functions to run the search and format the results. These functions, by default, include/use a pager.
- Specifically, Search by Page calls the core function search_data() to perform and format the search. search_data() ends up calling back into Search by Page to do the search, and Search by Page calls do_search() to perform the search, which looks at ?page=N on the URL and find the appropriate page of results. To format the results, search_data() uses theme('search_results'). The default implementation of that prints out the results along with a pager.
- Your theme can override theme('search_results'), so you might want to either test with a different theme, or make sure that if your theme overrides theme('search_results') that it prints out the $pager variable.
Let me know how this works out...
Comment #3
milesw commentedI'm experiencing the exact same issue on two different development servers, both running Drupal 6.12.
The module appears to be working just fine, but I only get 10 results and no pagination links at the bottom. Switching themes back to Garland didn't seem to help. Let me know what I can do to help you get this one resolved.
You've got a great module here (and equally important, excellent documentation), so thanks for all the work that's gone into it!
Comment #4
jhodgdonThat's very odd, because I am definitely getting a pager when I run it on my site... Do you get a pager when you use the core Search module, as opposed to Search by Page?
Comment #5
milesw commentedFound the cause of my problem: Safari
Somehow it was suppressing the pager -- it wasn't just hidden, it was missing from the page source. The same was happening on both servers.
Even weirder, I did a cache/cookies/history reset with a search result page open on server1 and it started showing the pagination on server1...but not server2. I had to open a search results page on server#2 when doing the reset to start seeing a pager there.
This is the latest version of Safari, 4.0.2 (5530.19)
Comment #6
jhodgdonThat is seriously strange. I am glad you have found your problem, and that would explain why it was working for me (not a Mac user).
Maybe that is the same issue the other person was having?
Comment #7
jhodgdonAlso, was your Safari issue specific to Search by Page, or was it also happening for the core Search module and other Drupal pagers? It might be worth seeing if that is in the issue queue for Drupal...
Comment #8
milesw commentedIt was happening only for results delivered by Search by Page. The pager for core search was showing pagination as expected.
Comment #9
jhodgdonInteresting, since Search by Page is using core Search's theming functions... well, I'm glad you resolved the problem anyway...
Comment #10
milesw commentedWelp, I thought this was solved, but I just had the same thing happen with Firefox. The pager was not displaying until I cleared all private data. Once I figure out the steps to reproduce I'll post them here.
Comment #11
jhodgdonThat would be very helpful, thanks! It's always difficult/impossible to fix an issue until you can reproduce it on your own test system...
Comment #12
milesw commentedOk, I was able to reproduce in both Safari and Firefox on two separate installations. The pager is not appearing once I'm logged in as a Drupal user. So I guess when I was clearing cookies before, this was effectively leaving me logged out.
1. Cleared out all caches, cookies, history
2. Performed a search at /search/search_by_page
* Pager is displayed *
3. Logged in as a site admin (see permissions below)
4. Performed same search at /search/search_by_page
* No pager is displayed *
5. Log out
* Pager comes back *
Note: I also tested with /search_pages and experienced the same thing
Note: Tested core search the same way and pager was always displayed
Permissions:
search module
administer search: (admin)
search content: (anonymous) (authenticated) (admin)
use advanced search: (admin)
search_by_page module
administer search by page: (admin)
search by page: (anonymous) (authenticated) (admin)
Any other permissions I should look at?
Comment #13
jhodgdonThanks for the detailed report. I will look into this and see what I can find out.
Comment #14
jhodgdonComment #15
jhodgdonOK, I see what the problem is (see below if you are interested).
I think I can fix this. Will report back shortly...
If you're interested in what the problem is...
One of Search by Page's central ideas is to search based on your theme's rendering of each page, rather than the default view of nodes. This happens during search indexing, but also when generating the search results page (to generate the excerpt, Search by Page renders the item first, to get all the text). But the process of rendering is screwing up Drupal's rather ad-hoc global way of keeping track of whether it needs to display a pager or not for the main search results page. Sigh.
The reason this is happening for you when you're logged in vs. not logged in is the same as for me, I'm guessing: you have permissions set for a logged-in user to see something on some pages that a non-logged-in user cannot see. For me, this was the "access comments" permission, which meant that when viewing a node in search results as a logged-in user, Search by Page would be trying to render the comment section, which uses a page-able query. And this was overlapping with Search's page-able query, and screwing up the global pager arrays. When I turned on anonymous "access comments" permission, I had the same problem (disappearing pagers) for the anonymous user.
Anyway, I can hopefully fix this by storing the global pager arrays before generating excerpts, and then restoring them back before the search page itself is displayed. I'll report back shortly.
Comment #16
jhodgdonOK, it actually wasn't too difficult to fix. I have committed the change to the 6.x-1.x-dev branch of Search by Page:
http://drupal.org/cvs?commit=250590
If you wait a few hours, you can download the development snapshot and get the changed module, or you can get the fix sooner by using CVS, if you are so inclined. I'll also probably be releasing this fix, along with a couple of other bug fixes, as a new version of Search by Page in the next few days as well.
Thanks both of you for your help in reporting and assisting in trouble-shooting this issue!
Comment #17
milesw commentedYikes, I obviously never would have pinpointed that one. I just installed the snapshot and everything appears to be working as expected. Thanks for fixing it so quickly!
I suppose I owe Safari an apology. It's treated me so well up until this point, hopefully this won't be the end of a great relationship...
Comment #18
jhodgdonI decided there were enough urgent bug fixes to make an official release, so this is now fixed in version 6.x-1.2 of Search by Page.