Closed (duplicate)
Project:
Drupal core
Version:
6.x-dev
Component:
search.module
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
2 Oct 2006 at 09:54 UTC
Updated:
11 May 2007 at 02:36 UTC
Jump to comment: Most recent file
Comments
Comment #1
mo6See also the discussion at: http://drupal.org/node/79744
Comment #2
zoo33 commentedI just encountered the same problem while developing a module that calls do_search(). I'd like to see an argument added to do_search(), something like:
$results_per_page = 10or:
$results_per_page = variable_get('search_results_per_page',10)I made a very simple patch of the first suggestion above. It's against HEAD. Would be great if someone who has worked on this module before would review it.
Comment #3
zoo33 commented...and here's the file.
Comment #4
zoo33 commented...and here's another patch that takes the other approach and adds a setting for the number of search results to display. I must confess that I haven't had the time to test it yet, but I'll try to do that asap.
The first one is perhaps "safer" to commit since we're in a code freeze. Neither of them requires any changes to other code however.
Comment #5
simeIn the interest reducing variable explosion, maybe some generic variables that could be used by other modules.
Also, I wouldn't worry about this sort of thing:
This just adds cruft and when you look at the variable_get function you'll see that you're not saving much code.
Comment #6
zoo33 commentedYes, it might be a good idea to centralize the number of posts per page setting. On the other hand, you might want different settings for the front page, taxonomy lists, forums etc. I don't really care – all I need is the new argument for
do_search().Anyone in favor of the first patch? Any other ideas?
Comment #7
zoo33 commentedI've given the second patch some more thought and come to the conclusion that the calls to
variable_get()really shouldn't be indo_search()but rather in the functions that calldo_search().So I'm in favor of committing the first patch and leave
do_query()like that. When that is done we can consider if we should add the user setting and use that in any functions that calldo_query().Comment #8
dwwsee http://drupal.org/node/33809 or http://drupal.org/node/39954 as 2 more general (and much older) issues about the same thing.