Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix some more queries + tidy
  • Loading branch information
mickeyn committed Apr 29, 2016
1 parent 171368c commit 266f5ae
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 15 deletions.
2 changes: 1 addition & 1 deletion lib/MetaCPAN/Document/Release.pm
Expand Up @@ -265,7 +265,7 @@ sub _build_first {
},

# REINDEX: after a full reindex, the above line is to replaced with:
# { term => { first => \1 } },
# { term => { first => 1 } },
# currently, the "first" property is not computed on all releases
# since this feature has not been around when last reindexed
]
Expand Down
2 changes: 1 addition & 1 deletion lib/MetaCPAN/Script/Latest.pm
Expand Up @@ -62,7 +62,7 @@ sub run {

return if ( !@filter && $self->distribution );

my @module_filters = { term => { 'module.indexed' => \1 } };
my @module_filters = { term => { 'module.indexed' => 1 } };
push @module_filters, @filter
? { terms => { "module.name" => \@filter } }
: { exists => { field => "module.name" } };
Expand Down
6 changes: 3 additions & 3 deletions lib/MetaCPAN/Script/Pagerank.pm
Expand Up @@ -77,9 +77,9 @@ sub get_recent_modules {
query => { match_all => {} },
filter => {
and => [
{ term => { 'file.status' => 'latest' } },
{ term => { 'file.module.indexed' => \1 } },
{ term => { 'file.module.authorized' => \1 } },
{ term => { 'status' => 'latest' } },
{ term => { 'module.indexed' => 1 } },
{ term => { 'module.authorized' => 1 } },
]
}
}
Expand Down
17 changes: 9 additions & 8 deletions lib/MetaCPAN/Server/Controller/Source.pm
Expand Up @@ -45,12 +45,12 @@ sub get : Chained('index') : PathPart('') : Args {
and => [
{
exists => {
field => 'file.module.name',
field => 'module.name',
}
},
{
term => {
'file.module.indexed' => \1
'module.indexed' => 1
}
},
]
Expand All @@ -59,10 +59,10 @@ sub get : Chained('index') : PathPart('') : Args {
and => [
{
exists => {
field => 'file.pod.analyzed',
field => 'pod.analyzed',
}
},
{ term => { 'file.indexed' => \1 } },
{ term => { indexed => 1 } },
]
},
]
Expand All @@ -87,10 +87,11 @@ sub get : Chained('index') : PathPart('') : Args {
= "distribution/$file->{distribution}/$file->{path}";
}
elsif ( !$module->{authorized} || !$module->{indexed} ) {
$links->{$name}
= 'release/'
. ( $module->{associated_pod}
|| "$author/$release/$file->{path}" );
$links->{$name} = 'release/' . (
$module->{associated_pod}

|| "$author/$release/$file->{path}"
);
}
}
$c->stash->{link_mappings} = $links;
Expand Down
4 changes: 2 additions & 2 deletions t/release/scripts.t
Expand Up @@ -47,12 +47,12 @@ is( $release->main_module, 'Scripts', 'main_module ok' );
[
{
documentation => 'catalyst',
indexed => \1,
indexed => 1,
mime => 'text/x-script.perl'
},
{
documentation => 'starman',
indexed => \1,
indexed => 1,
mime => 'text/x-script.perl'
}
],
Expand Down

0 comments on commit 266f5ae

Please sign in to comment.