Allow searching for store and drv paths. Only does a complete match to reduce load on database.
This commit is contained in:
parent
2c7a479994
commit
bfc1b0e76a
|
@ -265,7 +265,7 @@ sub search :Local Args(0) {
|
|||
|
||||
error($c, "Query is empty.") if $query eq "";
|
||||
error($c, "Invalid character in query.")
|
||||
unless $query =~ /^[a-zA-Z0-9_\-]+$/;
|
||||
unless $query =~ /^[a-zA-Z0-9_\-\/.]+$/;
|
||||
|
||||
$c->stash->{limit} = 500;
|
||||
|
||||
|
@ -295,6 +295,11 @@ sub search :Local Args(0) {
|
|||
, "+as" => ["enabled"]
|
||||
, rows => $c->stash->{limit} + 1
|
||||
} ) ];
|
||||
|
||||
$c->stash->{builds} = [ $c->model('DB::Builds')->search(
|
||||
{ -or => { "buildoutputs.path" => trim($query), "drvpath" => trim($query)} },
|
||||
{ order_by => ["id desc"], join => ["buildoutputs"] } ) ];
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -60,6 +60,14 @@
|
|||
|
||||
[% END %]
|
||||
|
||||
[% IF builds.size > 0; matched = 1 %]
|
||||
|
||||
<p>The following builds match your query:[% IF jobs.size > limit %] <span class="text-warning">(first [% limit %] results only)</span>[% END %]</p>
|
||||
|
||||
[% INCLUDE renderBuildList %]
|
||||
|
||||
[% END %]
|
||||
|
||||
[% IF !matched %]
|
||||
<div class="alert alert-warn">Sorry! Nothing matches your
|
||||
query.</div>
|
||||
|
|
2
src/sql/upgrade-12.sql
Normal file
2
src/sql/upgrade-12.sql
Normal file
|
@ -0,0 +1,2 @@
|
|||
|
||||
create index IndexBuildOutputsOnPath on BuildOutputs(path);
|
Loading…
Reference in a new issue