Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/lib/Hydra/Controller/Root.pm
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,9 @@ sub steps :Local Args(0) {

sub search :Local Args(0) {
my ($self, $c) = @_;

badRequest($c, "Search is disabled in this Hydra instance") if $c->config->{disable_search};

$c->stash->{template} = 'search.tt';

my $query = trim $c->request->params->{"query"};
Expand Down
8 changes: 5 additions & 3 deletions src/root/topbar.tt
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,11 @@
[% END %]

[% IF showPrivate %]
<form class="form-inline" action="[% c.uri_for('/search') %]">
<input name="query" type="text" class="form-control" placeholder="Search" [% HTML.attributes(value => c.req.params.query) %]/>
</form>
[% UNLESS c.config.disable_search %]
Copy link
Member

@mweinelt mweinelt Jan 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
[% UNLESS c.config.disable_search %]
[% UNLESS c.config.search_enable %]

Wondering if going forward we want more nixos module like behaviour, where the scope comes first, and we use positive toggles (which can default either way) rather than negative ones.

<form class="form-inline" action="[% c.uri_for('/search') %]">
<input name="query" type="text" class="form-control" placeholder="Search" [% HTML.attributes(value => c.req.params.query) %]/>
</form>
[% END %]
[% END %]

<ul class="navbar-nav">
Expand Down