Feature #9909
closedSearch in project and its subprojects by default
Added by ed boel almost 13 years ago. Updated over 7 years ago.
0%
Description
The default search scope when in a project is now only the selected project.
In my setup there are about 25 different projects, so it is easy if the search scope would always be 'all projects' or 'this and its subprojects'. Is it possible to add a configuration option to enable that?
Files
9909_set_default_search_scope_to_project_and_its_subprojects.patch (3.51 KB) 9909_set_default_search_scope_to_project_and_its_subprojects.patch | Marius BĂLTEANU, 2017-04-11 00:07 | ||
9909_default_search_scope_v2.patch (5.47 KB) 9909_default_search_scope_v2.patch | Marius BĂLTEANU, 2017-04-13 00:12 |
Related issues
Updated by John Wilcox almost 13 years ago
We are using Redmine internally in our organization and the current search function is confusing for our users also. We are using Redmine for task management (e.g. no RCS and code development stuff) and we have built an hierarchy of projects based on the organizational structure. For example, CIO has three departements beneath him and when searching, by default he would like to search every "project" under him. As it now, he has to make too many clicks to get where he wants and on the other hand the default Redmine search method is not suitable for us at all. So if possible, please make it configurable (preferrably redmine-wide).
Updated by Robert Rath over 12 years ago
Actually there does exist this capability already. When searching from the initial search entry field (usually in the top right of the screen) you only have the choice of one project.
When you actually perform the initial search you are taken to the Redmine search page which gives you the option to search one of;
a) current project,
b) my projects, or
c) all projects.
So a nice to have feature change would be to place 'my projects' and 'all projects' in the initial project choice but not actually necessary.
Updated by André Bachmann over 11 years ago
A quick and dirty way to change this Redmine behaviour is to edit apps/controller/search_controller.rb and edit in class SearchController < ApplicationController
the various statements (for example, if you want to change the default search scope to global, you should change the else statement from @project
to nil
).
projects_to_search =
case params[:scope]
when 'all'
nil
when 'my_projects'
User.current.memberships.collect(&:project)
when 'subprojects'
@project ? (@project.self_and_descendants.active.all) : nil
else
#@project
nil
end
Updated by Dotan Cohen over 11 years ago
I very much agree that either searching all subprojects should be the default, or that the default should be configurable.
Updated by Ernő Rigó about 11 years ago
My solution was to update the search form via the site theme. You should create javascripts/theme.js with the following content:
function customSearch() { var node = document.getElementById("quick-search"); node.innerHTML = "<form actuion='/search' method='GET'>" + "<a href='/search'>Search:</a>" + "<input type=text name=q>" + "</form>"; }; if (window.jQuery) { $(window).load(customSearch); }
Other search options can be easily added via form fields.
Updated by Chi Song Tao over 8 years ago
I need this function, too.
Can the default search be configurable for each project?
Updated by Toshi MARUYAMA over 8 years ago
- Has duplicate Feature #23403: Make default search scope configurable added
Updated by Marius BĂLTEANU over 7 years ago
- File 9909_set_default_search_scope_to_project_and_its_subprojects.patch 9909_set_default_search_scope_to_project_and_its_subprojects.patch added
Many of our projects are organised in a main project with multiple subprojects. For these projects, our users use mostly the "Issues" page from the parent project because it offers a great visibility over the issues, a lot of filters and options (like group by project). Without any subproject filter, a query returns issues from parent project and its subprojects. But if you're using the search input, the results returned are only from the current project (parent in my case). Each time when I search something I've the expectation to get results from the subprojects too. A usual case is when I want to search for an issue after subject (is faster to use the search instead of adding the subject filter ).
The attached patch changes the search behaviour in order to include results from "<Project and its subprojects" by default. In this way, query scope and search scope are consistent between them.
I'm not sure if it is worth it to add a setting in admin for this.
Updated by Go MAEDA over 7 years ago
- Target version set to Candidate for next major release
I think that the suggested patch by Marius can improve consistency.
We see issues of subprojects by default in issues page (Default value of Setting.display_subprojects_issues is True). So including issues from subprojects in search results by default is very natural.
Updated by Marius BĂLTEANU over 7 years ago
Go MAEDA wrote:
We see issues of subprojects by default in issues page (Default value of Setting.display_subprojects_issues is True). So including issues from subprojects in search results by default is very natural.
Oh, I didn't know that displaying subprojects issues on main projects is configurable (my bad). In this case, I think that it'll be better to rename the option in something like "Include subprojects issues on main projects issues and search by default" and make the patch to take into account the setting. In this way, it'll be consistent in both cases (with option enabled and disabled).
What do you think, Go MAEDA?
Updated by Go MAEDA over 7 years ago
- Target version deleted (
Candidate for next major release)
Marius BALTEANU wrote:
Go MAEDA wrote:
We see issues of subprojects by default in issues page (Default value of Setting.display_subprojects_issues is True). So including issues from subprojects in search results by default is very natural.
In this case, I think that it'll be better to rename the option in something like "Include subprojects issues on main projects issues and search by default" and make the patch to take into account the setting. In this way, it'll be consistent in both cases (with option enabled and disabled).
Absolutely agree. It will be even better.
Updated by Marius BĂLTEANU over 7 years ago
Thanks, I'll update the patch soon.
Updated by Marius BĂLTEANU over 7 years ago
Here it is the updated patch: 9909_default_search_scope_v2.patch
Updated by Go MAEDA over 7 years ago
- Target version set to 3.4.0
The patch 9909_default_search_scope_v2.patch improve usability, and consistensy between search engine and issue tracking. Marius BALTEANU.
Setting target version to 3.4.0.
Updated by Jean-Philippe Lang over 7 years ago
- Subject changed from set default search scope of a project to Search in project and its subprojects by default
- Status changed from New to Closed
- Assignee set to Jean-Philippe Lang
- Resolution set to Fixed
I've made a simple change to search by default in project and its subprojects. It's based on an helper that can be easily patched, rather than changing the logic in the search controller. Unlike the search engine, the setting is (almost) specific to issues display_subprojects_issues, I prefer not to reuse it in this case. If it's needed, we'll add a specific setting for the default search scope.
Updated by Mischa The Evil over 7 years ago
- Has duplicate Feature #22125: Make Search default to current project and sub projects added
Updated by Marius BĂLTEANU over 6 years ago
- Has duplicate Feature #24764: Search in subprojects added
Updated by Go MAEDA over 5 years ago
- Related to Defect #30923: Project search should select subprojects scope when the project has subprojects added