This allows us to use facet from other dataset, and quickly filter it
just to values which are available in current set.
} elsif ( $sort =~ m/d/i ) {
$numeric ? $b <=> $a : lc $b cmp lc $a;
} elsif ( $sort =~ m/c/i ) {
- $facet->{$b} <=> $facet->{$a};
+ ( $facet->{$b} || -1 ) <=> ( $facet->{$a} || -1 )
} else {
warn "unknown sort: $sort";
$a cmp $b;
% foreach my $n ( @$facet_names ) {
<li>
<label>
-<input type=checkbox name="filter_vals" value="<%= $n %>" <%= $checked->{$n} ? 'checked' : '' %>>
+<input type=checkbox name="filter_vals" value="<%= $n %>" <%= $checked->{$n} && defined $facet->{$n} ? 'checked' : '' %>>
<%= $n %>
</label>
+% if ( defined $facet->{$n} ) {
<span class="count"><%= $facet->{$n} %></span>
+% }
% }
</ul>