diff --git a/src/lib/Hydra/Controller/Root.pm b/src/lib/Hydra/Controller/Root.pm index ff56f7b0..7ea27977 100644 --- a/src/lib/Hydra/Controller/Root.pm +++ b/src/lib/Hydra/Controller/Root.pm @@ -296,10 +296,15 @@ sub search :Local Args(0) { , rows => $c->stash->{limit} + 1 } ) ]; + # Perform build search in separate queries to prevent seq scan on buildoutputs table. $c->stash->{builds} = [ $c->model('DB::Builds')->search( - { -or => { "buildoutputs.path" => trim($query), "drvpath" => trim($query)} }, + { "buildoutputs.path" => trim($query) }, { order_by => ["id desc"], join => ["buildoutputs"] } ) ]; + $c->stash->{buildsdrv} = [ $c->model('DB::Builds')->search( + { "drvpath" => trim($query) }, + { order_by => ["id desc"] } ) ]; + } diff --git a/src/root/search.tt b/src/root/search.tt index 6cd29041..06f1e8ed 100644 --- a/src/root/search.tt +++ b/src/root/search.tt @@ -1,6 +1,21 @@ [% WRAPPER layout.tt title="Search results" %] [% PROCESS common.tt %] +[% matched = 0 %] + +[% BLOCK renderBuildSearch %] + +[% IF builds.size > 0 %] + +
The following builds match your query:[% IF builds.size > limit %] (first [% limit %] results only)[% END %]
+ + [% INCLUDE renderBuildList %] + +[% END %] + +[% END; %] + + [% IF projects.size > 0; matched = 1 %]The following projects match your query:
@@ -60,17 +75,13 @@ [% END %] -[% IF builds.size > 0; matched = 1 %] +[% INCLUDE renderBuildSearch %] +[% INCLUDE renderBuildSearch builds=buildsdrv %] -The following builds match your query:[% IF jobs.size > limit %] (first [% limit %] results only)[% END %]
- - [% INCLUDE renderBuildList %] - -[% END %] +[% IF builds.size > 0 || buildsdrv.size > 0 ; matched = 1 ; END %] [% IF !matched %] -