forked from lix-project/hydra
Merge pull request #654 from nlewo/lewo-search-by-hash
Allow to search builds by hash
This commit is contained in:
commit
2b4658b6ea
|
@ -422,11 +422,11 @@ sub search :Local Args(0) {
|
||||||
|
|
||||||
# Perform build search in separate queries to prevent seq scan on buildoutputs table.
|
# 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(
|
||||||
{ "buildoutputs.path" => trim($query) },
|
{ "buildoutputs.path" => { ilike => "%$query%" } },
|
||||||
{ order_by => ["id desc"], join => ["buildoutputs"] } ) ];
|
{ order_by => ["id desc"], join => ["buildoutputs"] } ) ];
|
||||||
|
|
||||||
$c->stash->{buildsdrv} = [ $c->model('DB::Builds')->search(
|
$c->stash->{buildsdrv} = [ $c->model('DB::Builds')->search(
|
||||||
{ "drvpath" => trim($query) },
|
{ "drvpath" => { ilike => "%$query%" } },
|
||||||
{ order_by => ["id desc"] } ) ];
|
{ order_by => ["id desc"] } ) ];
|
||||||
|
|
||||||
$c->stash->{resource} = { projects => $c->stash->{projects},
|
$c->stash->{resource} = { projects => $c->stash->{projects},
|
||||||
|
|
|
@ -688,3 +688,9 @@ create index IndexBuildsOnKeep on Builds(keep) where keep = 1;
|
||||||
create index IndexJobsetEvalsOnJobsetId on JobsetEvals(project, jobset, id desc) where hasNewBuilds = 1;
|
create index IndexJobsetEvalsOnJobsetId on JobsetEvals(project, jobset, id desc) where hasNewBuilds = 1;
|
||||||
|
|
||||||
create index IndexBuildsOnNotificationPendingSince on Builds(notificationPendingSince) where notificationPendingSince is not null;
|
create index IndexBuildsOnNotificationPendingSince on Builds(notificationPendingSince) where notificationPendingSince is not null;
|
||||||
|
|
||||||
|
#ifdef POSTGRESQL
|
||||||
|
-- Provide an index used by LIKE operator on builds.drvpath (search query)
|
||||||
|
CREATE EXTENSION pg_trgm;
|
||||||
|
CREATE INDEX IndexTrgmBuildsOnDrvpath ON builds USING gin (drvpath gin_trgm_ops);
|
||||||
|
#endif
|
||||||
|
|
2
src/sql/upgrade-57.sql
Normal file
2
src/sql/upgrade-57.sql
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
CREATE EXTENSION pg_trgm;
|
||||||
|
CREATE INDEX IndexTrgmBuildsOnDrvpath ON builds USING gin (drvpath gin_trgm_ops);
|
Loading…
Reference in a new issue