Permalink
Browse files

queries

  • Loading branch information...
1 parent db4e8f1 commit c7073bce7d1aa867b0f1bd460b6d8bac36efbe74 @monken monken committed Dec 2, 2011
Showing with 35 additions and 5 deletions.
  1. +34 −4 lib/MetaCPAN/Web/Model/API/Release.pm
  2. +1 −1 root/recent.html
@@ -43,12 +43,40 @@ sub get {
}
sub recent {
- my ( $self, $page ) = @_;
+ my ( $self, $page, $type ) = @_;
+ my $query;
+ if ( $type eq 'n' ) {
+ $query = {
+ constant_score => {
+ filter => {
+ and => [
+ { term => { first => \1, } },
+ { not => {
+ filter => { term => { status => 'backpan' } }
+ }
+ },
+ ]
+ }
+ }
+ };
+ }
+ elsif ( $type eq 'a' ) {
+ $query = { match_all => {} };
+ }
+ else {
+ $query = {
+ constant_score => {
+ filter => {
+ not => { filter => { term => { status => 'backpan' } } }
+ }
+ }
+ };
+ }
$self->request(
'/release/_search',
{ size => 100,
from => ( $page - 1 ) * 100,
- query => { match_all => {} },
+ query => $query,
sort => [ { 'date' => { order => "desc" } } ]
}
);
@@ -80,8 +108,10 @@ sub modules {
]
},
{ and => [
- { exists =>
- { field => 'file.pod.analyzed' }
+ { exists => {
+ field =>
+ 'file.pod.analyzed'
+ }
},
{ term =>
{ 'file.indexed' => \1 }
View
@@ -5,7 +5,7 @@
<hr/>
<strong>Filter</strong>
<form action="<% c.uri_for('/recent') %>" method="get" onchange="this.form.submit()">
- <%- filter = { l = 'Latest releases', n = 'New distributions', a = 'All' };
+ <%- filter = { l = 'Latest releases', n = 'New distributions', a = 'Including BackPAN' };
FOR item IN ['l', 'n', 'a']; %>
<label><input type="radio" name="f" value="<% item %>"<% IF c.req.params.f == item; ' checked'; END %> onchange="this.form.submit()"> <% filter.${item} %></label>
<% END %>

0 comments on commit c7073bc

Please sign in to comment.