Postponed
Project:
Drupal core
Version:
main
Component:
search.module
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
2 Feb 2010 at 22:18 UTC
Updated:
1 Apr 2026 at 04:00 UTC
Jump to comment: Most recent, Most recent file




Comments
Comment #1
jhodgdonThis is a great idea, but it is too late to change Drupal 7, much less Drupal 6, for this new feature.
Comment #2
colaniosif.peterfi: It would be great if you could still provide the patch for D6 here. The solution for D5, which looks to be quite similar, is posted over at #166814: Change the number of results in search (which I've marked as a duplicate of this issue).
Comment #3
colanComment #4
dww#33809: Make pagers not suck
Comment #5
jhodgdonI'd like to leave this open, specifically for the search module, for Drupal 8.
a) That issue may never be fixed in D8, who knows.
b) That issue mostly is for admin pages.
c) That issue proposes to create globals or variables and leave the settings pages to contrib modules.
The number of search results, IMO, since it is a visitor-facing and visitor-experience issue, needs a config setting exposed in core, on the search settings page.
Comment #6
brian_c commentedKinda stunning that "10 results per page" is hard-coded into Drupal core, with no way of changing it. (Especially since it seems this was identified nearly 5 years ago: http://drupal.org/node/33809)
Is there really no chance of adding a new hook or config setting into D6 or D7 that applications could modify, which would simply default to 10 for all existing sites?
Comment #7
jhodgdonD6 - no chance.
D7... As this is a feature request, you would need to get approval from Dries or webchick that this exception to the development process could be made, before I would even bother to make a patch. And in my opinion, the way to do it would be to make a setting that should go onto the Search settings page.
Comment #8
selvakumar commentedThis is for D7 patch files. I fixed this change request. Kindly apply this patches.... Changes are made in the following files...
user.module
node.module
search.admin.inc - Kindly replace --- symbols to +++, and +++ to ---
search.install - Kindly replace --- symbols to +++, and +++ to ---
Comment #9
jhodgdonSorry. This is a *new feature*. Drupal 7 is frozen for new features -- it is in beta release, and new features have not been accepted for several months. Please leave this as a Drupal 8 issue.
Comment #10
asb commentedsub
Comment #11
2dareis2do commentedYes,
I read somewhere that patching drupal was really not recommended but I too would be interested in this patch. Just to clarify, does it:
1. Adjust the amount of nodes to display on a search results page?
2. Adjust the pager to reflect this changes?
(FYI The problem I have is that when printing the search results in Firefox, they seem to mess up and the one page seems to be printed across three - very messy. This patch would allow me to reduce the amount of results on a page and therefore print correctly in Firefox.)
Comment #12
jhodgdonPlease do not change the version again! See comment #9. Thanks.
Comment #13
2dareis2do commentedPlease read my question again! I was asking if the patch is available for drupal 6 and if so where do I get it from?
I have no intention of changing the version again and accept that this change will only be available in Drupal 8. I see the patch for 7 but cannot see the one for 6!
Comment #14
jhodgdonI don't know of anyone making a patch for Drupal 6. It will never get added to Drupal 6, so probably not (new features are now material for Drupal 8). Sorry!
Just to clarify, you can feel free to ask questions about Drupal 6 on any issue, but changing the Version on the issue is not as welcome. (When you change the Project, Version, Component, etc. above the Comment field, you are changing it for the entire issue, not just for your comment.)
Comment #15
ñull commentedBreak the tradition! I want a release for 6. This issue (a duplicate of it) is 7 years old and I think an obvious setting as this deserves a backport.
Comment #16
colanIf you want a patch for 6, they you'll probably either have to write it yourself, or pay someone to do it. Core developers generally only work in later releases.
If you want better paging now, do it with Views.
Comment #17
brian_c commentedYeah just use Views, you can setup a "Search Terms" exposed filter, that works directly off Drupal's search index. Presto, instant search engine, fully customizable.
Comment #18
douggreen commentedIMO, we should replace all calls to limit() in core with hard coded numbers, to use variables. But such a patch might be harder to get accepted, so I think that just fixing this for search is a good start. Attached is an updated patch.
Comment #19
douggreen commentedComment #20
ParisLiakos commented@douggreen so far so good,but shouldnt the setting be exposed in search settings UI as well?
Comment #21
agileware commentedSubscribing
Comment #22
alan d. commentedFor D7 users plus, I've just implemented this in the search config module. Checkout from dev.
Positive feedback about this and the individual node search restrictions will help push out 7.x-1.1 release.
Comment #23
cabita commented#8: user.module.patch queued for re-testing.
Comment #24
rcross commentedI can't believe this hasn't been addressed since D5! and pushing it off to this other issue ([#33809: Make pagers not suck]) is just forcing this to be a dead end instead of just providing a fix.
Comment #25
rcross commentedfor reference #166814: Change the number of results in search has a patch for D6
Comment #26
ParisLiakos commented#18: 702940.patch queued for re-testing.
Comment #28
ParisLiakos commentedAttached patch that addresses #20 and uses the new config system as well
Comment #29
ParisLiakos commentedwould be good if someone reviews this before feature freeze..if we want to get this in drupal 8..
Comment #30
rcross commentedlooks good to me.
Comment #31
ParisLiakos commentedRerolled and rtbcing. It is pretty straightforward. Thanks rcross
Comment #32
ParisLiakos commentedSorry, meant to remove min and max parameters. Someone might need to display more than 100 results
Comment #33
alan d. commentedGood practice not to rtbtc your own patches :)
The number field validation function form_validate_number() passes if the field is empty. This would probably (?) cause issues1, so mark this field as required. Also using '#min' => 1 would also prevent crazy things if -1 or 0 were entered.
1 For example, PostgreSQL is more sensitive to garbage values being passed to it than MySQL.
Comment #34
ParisLiakos commented;)
Thanks Alan, patch attached that addresses #33
Comment #36
ParisLiakos commentedmissed a comma
Comment #37
ParisLiakos commentedComment #38
vimalgoradiya commented#36: 702940-make_search_result_limit_configurable-35.patch queued for re-testing.
Comment #39
ParisLiakos commented#36: 702940-make_search_result_limit_configurable-35.patch queued for re-testing.
Comment #40
ParisLiakos commentedReroll
Comment #41
xjmComment #42
ParisLiakos commentedok, someone in irc mentioned that we need some tests to get this rtbc
Edit Also beated me when adding tag
Comment #43
ParisLiakos commentedTests added
Comment #44
pit_zavra commentedComment #45
catchI'm not sure we should add a separate setting for this. the search results listing could be provided by a view, and then would be configurable for more things than this separately. Moving back to CNR and tagging usability.
Comment #46
catchAlso VDC tag.
Comment #47
jibran#43: search-result_limit_configurable-702940-43.patch queued for re-testing.
Comment #49
jibranTagging.
Comment #50
klonosI think we should postpone this on #2083717: Convert Search Results to Views (or close it as a duplicate or even make the other issue a META and this one one of its sub-issues).
Comment #51
swentel commentedreroll - couldn't make any decent interdiff out of this
Comment #52
jhodgdonThanks! This is looking pretty good.
I have a few comments:
a)
Can we just change the title to "Number of results per page" and cut out the description? We went to some lengths in #1559244: Clean up search settings page to clean up the search settings page, and this is exactly the type of clutter that we don't need. Actually, that other issue still needs a review. :)
b)
3th --> 3rd
c) I'd also like to call your attention to
#2123073: Move index.cron_limit setting to NodeSearch
The intent there is to decouple search.settings from node.module... so we might want to pass in the number of results per page as an argument to execute(), or else make Node and User search plugins have separate settings.
d) I think we need a test for User search too. It's interesting to me that the User module apparently was using 15 results per page, while Node was using 10. So probably the right fix for (c) is to make the setting plugin-specific.
Comment #53
ianthomas_ukThis will need to wait for #2042807: Convert search plugins to use a ConfigEntity and a PluginBag (shouldn't be long now)
Comment #54
jhodgdonOther issue is taken care of. This is not related to Views.
And by the way this should be configured in the Node/User search plugin, not on the main search settings, I think?
Comment #55
jhodgdonSince 8.0.x-beta1 has been released, our policy at this point is No feature requests until 8.1.x. See #2350615: [policy, no patch] What changes can be accepted during the Drupal 8 beta phase?. Sorry, it's just too late for 8.0.x at this point, so even if we had a viable patch, the core committers would not commit it. So unless we decide this is a Task or a Bug (and I don't think it is), we'll have to delay it.
Comment #67
joseph.olstadStill need this, but on D9
Comment #68
joseph.olstadComment #69
joseph.olstadbackport to D8.9.x
, for 9.3.x, see 66
Comment #70
joseph.olstadbackport to D9.0.x
, for 9.3.x see 66
Comment #71
joseph.olstadD9.0.x with PHPLint fixes
and
D9.3.x with PHPLint fixes
Comment #72
joseph.olstadD9.0.x with PHPLint fixes
and
D9.3.x with PHPLint fixes
Comment #73
joseph.olstadD9.0.x with PHPLint fixes
and
D9.3.x with PHPLint fixes
see interdiff.
Comment #74
joseph.olstadHmm,I actually got something to work.
I'm still reviewing the patch.
Big thanks to those above that created the original patch.
was a challenging reroll though!
Comment #75
gauravvvv commentedRe-rolled patch #74. Please review. fixed the custom command failed.
Comment #76
joseph.olstadThanks @Gauravmahlawat
One more (for my 9.0 site)
Comment #77
joseph.olstadHere's a fix for 9.3 from comment #75
some unrelated stuff went into 75
here's the clean version. same interdiff as 75
Comment #79
joseph.olstadnew patch for the win
Comment #80
mitthukumawat commentedI have tested patch #79 manually and it is working as expected in drupal 9.3.x-dev version.
I can see the Results per page field in Results fieldset on search configuration page.
The results per page is configured successfully and this value being available to export in
search.settingsAdding screenshot of testing results.
Comment #82
joseph.olstadthanks @mitthukumawat
just need to fix the one remaining fail
Comment #83
joseph.olstadRolling a new patch
Comment #84
joseph.olstadNew patch
Comment #85
joseph.olstadComment #88
joseph.olstadTrying again
Comment #90
joseph.olstadNew 9.3 patch
Comment #91
joseph.olstadnew interdiff
Comment #92
joseph.olstadYay! passing!
Comment #93
joseph.olstadThanks @mitthukumawat for the screenshots and illustrations and for testing this functionality.
Before:

New setting:

Configuration export:

Default value:

Comment #94
joseph.olstadComment #95
joseph.olstadNeeds a reroll yet again. After over 11 years, I think it's time to get this one done.
I also am adressing the core maintainers comment from comment number 52
see new patch
Comment #97
joseph.olstadOoops
Comment #98
joseph.olstadtry again
Comment #99
joseph.olstadRTBC based on review in #702940-80: Add option 'Items per page' on admin/config/search/pages
Reroll was for recent changes to the test code. (this week).
Thanks for the quick review by @mitthukumawat.
Comment #100
joseph.olstadComment #101
joseph.olstadComment #102
joseph.olstadComment #103
joseph.olstadComment #104
joseph.olstadComment #105
quietone commentedI haven't read the issue, just taken a brief look a the patch.
These can use the Null Coalesce operator.
And a questions, should the limits be defined in a constant?
Comment #110
johnvClarifying title.
Changing option name (in title, not (yet) in patch) to 'Items per page', to be aligned with Views pager options.
BTW, shouldn't all core pages be converted to Views?
Comment #112
quietone commentedThe Search Module was approved for removal in #3476883: [Policy, no patch] Move Search module to contrib .
This is Postponed. The status is set according to two policies. The Remove a core extension and move it to a contributed project and the Extensions approved for removal policies.
The deprecation work is in #3565780: [meta] Tasks to deprecate the Search module and the removal work in #3565783: [meta] Tasks to remove the Search module.
Search will be moved to a contributed project before Drupal 12.0.0 is released.