diff --git a/src/lib/Hydra/Controller/Root.pm b/src/lib/Hydra/Controller/Root.pm index 6a54ad1c..ff56f7b0 100644 --- a/src/lib/Hydra/Controller/Root.pm +++ b/src/lib/Hydra/Controller/Root.pm @@ -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"] } ) ]; + } diff --git a/src/root/search.tt b/src/root/search.tt index f64be628..6cd29041 100644 --- a/src/root/search.tt +++ b/src/root/search.tt @@ -60,6 +60,14 @@ [% END %] +[% IF builds.size > 0; matched = 1 %] + +

The following builds match your query:[% IF jobs.size > limit %] (first [% limit %] results only)[% END %]

+ + [% INCLUDE renderBuildList %] + +[% END %] + [% IF !matched %]
Sorry! Nothing matches your query.
diff --git a/src/sql/upgrade-12.sql b/src/sql/upgrade-12.sql new file mode 100644 index 00000000..ea7504da --- /dev/null +++ b/src/sql/upgrade-12.sql @@ -0,0 +1,2 @@ + +create index IndexBuildOutputsOnPath on BuildOutputs(path);