https://www.redmine.org/https://www.redmine.org/favicon.ico?16793021292012-02-01T09:31:11ZRedmineRedmine - Feature #9909: Search in project and its subprojects by defaulthttps://www.redmine.org/issues/9909?journal_id=356852012-02-01T09:31:11ZJohn Wilcox
<ul></ul><p>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).</p> Redmine - Feature #9909: Search in project and its subprojects by defaulthttps://www.redmine.org/issues/9909?journal_id=373312012-04-11T04:25:18ZRobert Rath
<ul></ul><p>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.</p>
<p>When you actually perform the initial search you are taken to the Redmine search page which gives you the option to search one of;</p>
<p>a) current project,<br />b) my projects, or<br />c) all projects.</p>
<p>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.</p> Redmine - Feature #9909: Search in project and its subprojects by defaulthttps://www.redmine.org/issues/9909?journal_id=475832013-03-27T09:05:33ZAndré Bachmann
<ul></ul><p>A quick and dirty way to change this Redmine behaviour is to edit apps/controller/search_controller.rb and edit in <code>class SearchController < ApplicationController</code> the various statements (for example, if you want to change the default search scope to global, you should change the else statement from <code>@project</code> to <code>nil</code>).<br /><pre><code class="ruby syntaxhl"><span class="n">projects_to_search</span> <span class="o">=</span>
<span class="k">case</span> <span class="n">params</span><span class="p">[</span><span class="ss">:scope</span><span class="p">]</span>
<span class="k">when</span> <span class="s1">'all'</span>
<span class="kp">nil</span>
<span class="k">when</span> <span class="s1">'my_projects'</span>
<span class="no">User</span><span class="p">.</span><span class="nf">current</span><span class="p">.</span><span class="nf">memberships</span><span class="p">.</span><span class="nf">collect</span><span class="p">(</span><span class="o">&</span><span class="ss">:project</span><span class="p">)</span>
<span class="k">when</span> <span class="s1">'subprojects'</span>
<span class="vi">@project</span> <span class="p">?</span> <span class="p">(</span><span class="vi">@project</span><span class="p">.</span><span class="nf">self_and_descendants</span><span class="p">.</span><span class="nf">active</span><span class="p">.</span><span class="nf">all</span><span class="p">)</span> <span class="p">:</span> <span class="kp">nil</span>
<span class="k">else</span>
<span class="c1">#@project</span>
<span class="kp">nil</span>
<span class="k">end</span>
</code></pre></p> Redmine - Feature #9909: Search in project and its subprojects by defaulthttps://www.redmine.org/issues/9909?journal_id=511382013-08-08T17:05:53ZDotan Cohen
<ul></ul><p>I very much agree that either searching all subprojects should be the default, or that the default should be configurable.</p> Redmine - Feature #9909: Search in project and its subprojects by defaulthttps://www.redmine.org/issues/9909?journal_id=515442013-09-03T10:23:26ZErnő Rigó
<ul></ul><p>My solution was to update the search form via the site theme. You should create javascripts/theme.js with the following content:</p>
<pre>
<code class="javascript syntaxhl"><span class="kd">function</span> <span class="nx">customSearch</span><span class="p">()</span> <span class="p">{</span>
<span class="kd">var</span> <span class="nx">node</span> <span class="o">=</span> <span class="nb">document</span><span class="p">.</span><span class="nx">getElementById</span><span class="p">(</span><span class="dl">"</span><span class="s2">quick-search</span><span class="dl">"</span><span class="p">);</span>
<span class="nx">node</span><span class="p">.</span><span class="nx">innerHTML</span> <span class="o">=</span>
<span class="dl">"</span><span class="s2"><form actuion='/search' method='GET'></span><span class="dl">"</span> <span class="o">+</span>
<span class="dl">"</span><span class="s2"><a href='/search'>Search:</a></span><span class="dl">"</span> <span class="o">+</span>
<span class="dl">"</span><span class="s2"><input type=text name=q></span><span class="dl">"</span> <span class="o">+</span>
<span class="dl">"</span><span class="s2"></form></span><span class="dl">"</span><span class="p">;</span>
<span class="p">};</span>
<span class="k">if</span> <span class="p">(</span><span class="nb">window</span><span class="p">.</span><span class="nx">jQuery</span><span class="p">)</span> <span class="p">{</span>
<span class="nx">$</span><span class="p">(</span><span class="nb">window</span><span class="p">).</span><span class="nx">load</span><span class="p">(</span><span class="nx">customSearch</span><span class="p">);</span>
<span class="p">}</span>
</code><br /></pre>
<p>Other search options can be easily added via form fields.</p> Redmine - Feature #9909: Search in project and its subprojects by defaulthttps://www.redmine.org/issues/9909?journal_id=583522014-08-29T14:12:58ZMarc D.
<ul></ul><p>+1</p> Redmine - Feature #9909: Search in project and its subprojects by defaulthttps://www.redmine.org/issues/9909?journal_id=721092016-07-11T03:17:43ZChi Song Tao
<ul></ul><p>I need this function, too.</p>
<p>Can the default search be configurable for each project?</p> Redmine - Feature #9909: Search in project and its subprojects by defaulthttps://www.redmine.org/issues/9909?journal_id=728052016-08-21T04:51:39ZToshi MARUYAMA
<ul><li><strong>Has duplicate</strong> <i><a class="issue tracker-2 status-5 priority-4 priority-default closed" href="/issues/23403">Feature #23403</a>: Make default search scope configurable</i> added</li></ul> Redmine - Feature #9909: Search in project and its subprojects by defaulthttps://www.redmine.org/issues/9909?journal_id=779312017-04-10T22:08:28ZMarius BĂLTEANU
<ul><li><strong>File</strong> <a href="/attachments/18081">9909_set_default_search_scope_to_project_and_its_subprojects.patch</a> <a class="icon-only icon-download" title="Download" href="/attachments/download/18081/9909_set_default_search_scope_to_project_and_its_subprojects.patch">9909_set_default_search_scope_to_project_and_its_subprojects.patch</a> added</li></ul><p>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 ).</p>
<p>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.</p>
<p>I'm not sure if it is worth it to add a setting in admin for this.</p> Redmine - Feature #9909: Search in project and its subprojects by defaulthttps://www.redmine.org/issues/9909?journal_id=779432017-04-11T07:03:03ZGo MAEDA
<ul><li><strong>Target version</strong> set to <i>Candidate for next major release</i></li></ul><p>I think that the suggested patch by Marius can improve consistency.</p>
<p>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.</p> Redmine - Feature #9909: Search in project and its subprojects by defaulthttps://www.redmine.org/issues/9909?journal_id=779462017-04-11T07:13:51ZMarius BĂLTEANU
<ul></ul><p>Go MAEDA wrote:</p>
<blockquote>
<p>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.</p>
</blockquote>
<p>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 <strong>and search</strong> 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).</p>
<p>What do you think, Go MAEDA?</p> Redmine - Feature #9909: Search in project and its subprojects by defaulthttps://www.redmine.org/issues/9909?journal_id=779472017-04-11T07:45:29ZGo MAEDA
<ul><li><strong>Target version</strong> deleted (<del><i>Candidate for next major release</i></del>)</li></ul><p>Marius BALTEANU wrote:</p>
<blockquote>
<p>Go MAEDA wrote:</p>
<blockquote>
<p>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.</p>
</blockquote>
<p>In this case, I think that it'll be better to rename the option in something like "Include subprojects issues on main projects issues <strong>and search</strong> 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).</p>
</blockquote>
<p>Absolutely agree. It will be even better.</p> Redmine - Feature #9909: Search in project and its subprojects by defaulthttps://www.redmine.org/issues/9909?journal_id=779482017-04-11T07:46:50ZMarius BĂLTEANU
<ul></ul><p>Thanks, I'll update the patch soon.</p> Redmine - Feature #9909: Search in project and its subprojects by defaulthttps://www.redmine.org/issues/9909?journal_id=779822017-04-12T22:14:31ZMarius BĂLTEANU
<ul><li><strong>File</strong> <a href="/attachments/18098">9909_default_search_scope_v2.patch</a> <a class="icon-only icon-download" title="Download" href="/attachments/download/18098/9909_default_search_scope_v2.patch">9909_default_search_scope_v2.patch</a> added</li></ul><p>Here it is the updated patch: 9909_default_search_scope_v2.patch</p> Redmine - Feature #9909: Search in project and its subprojects by defaulthttps://www.redmine.org/issues/9909?journal_id=779912017-04-13T04:45:56ZGo MAEDA
<ul><li><strong>Target version</strong> set to <i>3.4.0</i></li></ul><p>The patch <a class="attachment" href="https://www.redmine.org/attachments/18098">9909_default_search_scope_v2.patch</a> improve usability, and consistensy between search engine and issue tracking. Marius BALTEANU.</p>
<p>Setting target version to 3.4.0.</p> Redmine - Feature #9909: Search in project and its subprojects by defaulthttps://www.redmine.org/issues/9909?journal_id=790802017-06-07T20:53:07ZJean-Philippe Langjp_lang@yahoo.fr
<ul><li><strong>Subject</strong> changed from <i>set default search scope of a project</i> to <i>Search in project and its subprojects by default</i></li><li><strong>Status</strong> changed from <i>New</i> to <i>Closed</i></li><li><strong>Assignee</strong> set to <i>Jean-Philippe Lang</i></li><li><strong>Resolution</strong> set to <i>Fixed</i></li></ul><p>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.</p> Redmine - Feature #9909: Search in project and its subprojects by defaulthttps://www.redmine.org/issues/9909?journal_id=796782017-07-03T14:19:12ZMischa The Evil
<ul><li><strong>Has duplicate</strong> <i><a class="issue tracker-2 status-5 priority-4 priority-default closed" href="/issues/22125">Feature #22125</a>: Make Search default to current project and sub projects</i> added</li></ul> Redmine - Feature #9909: Search in project and its subprojects by defaulthttps://www.redmine.org/issues/9909?journal_id=865502018-08-08T18:38:42ZMarius BĂLTEANU
<ul><li><strong>Has duplicate</strong> <i><a class="issue tracker-2 status-5 priority-4 priority-default closed" href="/issues/24764">Feature #24764</a>: Search in subprojects</i> added</li></ul> Redmine - Feature #9909: Search in project and its subprojects by defaulthttps://www.redmine.org/issues/9909?journal_id=904452019-02-27T03:10:03ZGo MAEDA
<ul><li><strong>Related to</strong> <i><a class="issue tracker-1 status-5 priority-4 priority-default closed" href="/issues/30923">Defect #30923</a>: Project search should select subprojects scope when the project has subprojects</i> added</li></ul>