forked from lix-project/hydra
When searching a path / drv path, use separate queries for both options to prevent seq. scan.
This commit is contained in:
parent
591aee0793
commit
fd7acd9bbf
|
@ -296,10 +296,15 @@ sub search :Local Args(0) {
|
||||||
, rows => $c->stash->{limit} + 1
|
, 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(
|
$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"] } ) ];
|
{ order_by => ["id desc"], join => ["buildoutputs"] } ) ];
|
||||||
|
|
||||||
|
$c->stash->{buildsdrv} = [ $c->model('DB::Builds')->search(
|
||||||
|
{ "drvpath" => trim($query) },
|
||||||
|
{ order_by => ["id desc"] } ) ];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,21 @@
|
||||||
[% WRAPPER layout.tt title="Search results" %]
|
[% WRAPPER layout.tt title="Search results" %]
|
||||||
[% PROCESS common.tt %]
|
[% PROCESS common.tt %]
|
||||||
|
|
||||||
|
[% matched = 0 %]
|
||||||
|
|
||||||
|
[% BLOCK renderBuildSearch %]
|
||||||
|
|
||||||
|
[% IF builds.size > 0 %]
|
||||||
|
|
||||||
|
<p>The following builds match your query:[% IF builds.size > limit %] <span class="text-warning">(first [% limit %] results only)</span>[% END %]</p>
|
||||||
|
|
||||||
|
[% INCLUDE renderBuildList %]
|
||||||
|
|
||||||
|
[% END %]
|
||||||
|
|
||||||
|
[% END; %]
|
||||||
|
|
||||||
|
|
||||||
[% IF projects.size > 0; matched = 1 %]
|
[% IF projects.size > 0; matched = 1 %]
|
||||||
|
|
||||||
<p>The following projects match your query:</p>
|
<p>The following projects match your query:</p>
|
||||||
|
@ -60,17 +75,13 @@
|
||||||
|
|
||||||
[% END %]
|
[% END %]
|
||||||
|
|
||||||
[% IF builds.size > 0; matched = 1 %]
|
[% INCLUDE renderBuildSearch %]
|
||||||
|
[% INCLUDE renderBuildSearch builds=buildsdrv %]
|
||||||
|
|
||||||
<p>The following builds match your query:[% IF jobs.size > limit %] <span class="text-warning">(first [% limit %] results only)</span>[% END %]</p>
|
[% IF builds.size > 0 || buildsdrv.size > 0 ; matched = 1 ; END %]
|
||||||
|
|
||||||
[% INCLUDE renderBuildList %]
|
|
||||||
|
|
||||||
[% END %]
|
|
||||||
|
|
||||||
[% IF !matched %]
|
[% IF !matched %]
|
||||||
<div class="alert alert-warn">Sorry! Nothing matches your
|
<div class="alert alert-warn">Sorry! Nothing matches your query.</div>
|
||||||
query.</div>
|
|
||||||
[% END %]
|
[% END %]
|
||||||
|
|
||||||
[% END %]
|
[% END %]
|
||||||
|
|
Loading…
Reference in a new issue