Skip to content

Commit 373da0d

Browse files
committed
query modules don't need to be given an index name anymore
1 parent d709a5e commit 373da0d

File tree

17 files changed

+18
-73
lines changed

17 files changed

+18
-73
lines changed

Diff for: lib/MetaCPAN/API/Plugin/Model.pm

+1-4
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,7 @@ has download => sub {
2121

2222
has search => sub {
2323
my $self = shift;
24-
return MetaCPAN::Query::Search->new(
25-
es => $self->app->es,
26-
index_name => 'cpan',
27-
);
24+
return MetaCPAN::Query::Search->new( es => $self->app->es, );
2825
};
2926

3027
has user => sub {

Diff for: lib/MetaCPAN/Document/Author/Set.pm

+1-4
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,7 @@ has query_author => (
1616

1717
sub _build_query_author {
1818
my $self = shift;
19-
return MetaCPAN::Query::Author->new(
20-
es => $self->es,
21-
index_name => $self->index->name,
22-
);
19+
return MetaCPAN::Query::Author->new( es => $self->es );
2320
}
2421

2522
__PACKAGE__->meta->make_immutable;

Diff for: lib/MetaCPAN/Document/CVE/Set.pm

+1-4
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,7 @@ has query_cve => (
2020

2121
sub _build_query_cve {
2222
my $self = shift;
23-
return MetaCPAN::Query::CVE->new(
24-
es => $self->es,
25-
index_name => 'cve',
26-
);
23+
return MetaCPAN::Query::CVE->new( es => $self->es );
2724
}
2825

2926
__PACKAGE__->meta->make_immutable;

Diff for: lib/MetaCPAN/Document/Contributor/Set.pm

+1-4
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,7 @@ has query_contributor => (
1616

1717
sub _build_query_contributor {
1818
my $self = shift;
19-
return MetaCPAN::Query::Contributor->new(
20-
es => $self->es,
21-
index_name => 'contributor',
22-
);
19+
return MetaCPAN::Query::Contributor->new( es => $self->es );
2320
}
2421

2522
__PACKAGE__->meta->make_immutable;

Diff for: lib/MetaCPAN/Document/Cover/Set.pm

+1-4
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,7 @@ has query_cover => (
1616

1717
sub _build_query_cover {
1818
my $self = shift;
19-
return MetaCPAN::Query::Cover->new(
20-
es => $self->es,
21-
index_name => 'cover',
22-
);
19+
return MetaCPAN::Query::Cover->new( es => $self->es );
2320
}
2421

2522
__PACKAGE__->meta->make_immutable;

Diff for: lib/MetaCPAN/Document/Distribution/Set.pm

+1-4
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,7 @@ has query_distribution => (
1616

1717
sub _build_query_distribution {
1818
my $self = shift;
19-
return MetaCPAN::Query::Distribution->new(
20-
es => $self->es,
21-
index_name => 'cpan',
22-
);
19+
return MetaCPAN::Query::Distribution->new( es => $self->es );
2320
}
2421

2522
__PACKAGE__->meta->make_immutable;

Diff for: lib/MetaCPAN/Document/Favorite/Set.pm

+1-4
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,7 @@ has query_favorite => (
2020

2121
sub _build_query_favorite {
2222
my $self = shift;
23-
return MetaCPAN::Query::Favorite->new(
24-
es => $self->es,
25-
index_name => $self->index->name,
26-
);
23+
return MetaCPAN::Query::Favorite->new( es => $self->es );
2724
}
2825

2926
__PACKAGE__->meta->make_immutable;

Diff for: lib/MetaCPAN/Document/File/Set.pm

+3-12
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,7 @@ has query_file => (
2525

2626
sub _build_query_file {
2727
my $self = shift;
28-
return MetaCPAN::Query::File->new(
29-
es => $self->es,
30-
index_name => $self->index->name,
31-
);
28+
return MetaCPAN::Query::File->new( es => $self->es );
3229
}
3330

3431
has query_favorite => (
@@ -41,10 +38,7 @@ has query_favorite => (
4138

4239
sub _build_query_favorite {
4340
my $self = shift;
44-
return MetaCPAN::Query::Favorite->new(
45-
es => $self->es,
46-
index_name => $self->index->name,
47-
);
41+
return MetaCPAN::Query::Favorite->new( es => $self->es );
4842
}
4943

5044
has query_release => (
@@ -57,10 +51,7 @@ has query_release => (
5751

5852
sub _build_query_release {
5953
my $self = shift;
60-
return MetaCPAN::Query::Release->new(
61-
es => $self->es,
62-
index_name => $self->index->name,
63-
);
54+
return MetaCPAN::Query::Release->new( es => $self->es );
6455
}
6556

6657
my @ROGUE_DISTRIBUTIONS = qw(

Diff for: lib/MetaCPAN/Document/Mirror/Set.pm

+1-4
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,7 @@ has query_mirror => (
1616

1717
sub _build_query_mirror {
1818
my $self = shift;
19-
return MetaCPAN::Query::Mirror->new(
20-
es => $self->es,
21-
index_name => $self->index->name,
22-
);
19+
return MetaCPAN::Query::Mirror->new( es => $self->es );
2320
}
2421

2522
__PACKAGE__->meta->make_immutable;

Diff for: lib/MetaCPAN/Document/Package/Set.pm

+1-4
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,7 @@ has query_package => (
1616

1717
sub _build_query_package {
1818
my $self = shift;
19-
return MetaCPAN::Query::Package->new(
20-
es => $self->es,
21-
index_name => $self->index->name,
22-
);
19+
return MetaCPAN::Query::Package->new( es => $self->es );
2320
}
2421

2522
__PACKAGE__->meta->make_immutable;

Diff for: lib/MetaCPAN/Document/Permission/Set.pm

+1-4
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,7 @@ has query_permission => (
1616

1717
sub _build_query_permission {
1818
my $self = shift;
19-
return MetaCPAN::Query::Permission->new(
20-
es => $self->es,
21-
index_name => $self->index->name,
22-
);
19+
return MetaCPAN::Query::Permission->new( es => $self->es );
2320
}
2421

2522
__PACKAGE__->meta->make_immutable;

Diff for: lib/MetaCPAN/Document/Release/Set.pm

+1-4
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,7 @@ has query_release => (
3535

3636
sub _build_query_release {
3737
my $self = shift;
38-
return MetaCPAN::Query::Release->new(
39-
es => $self->es,
40-
index_name => $self->index->name,
41-
);
38+
return MetaCPAN::Query::Release->new( es => $self->es );
4239
}
4340

4441
sub find_github_based {

Diff for: lib/MetaCPAN/Query/Role/Common.pm

-2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,4 @@ use Moose::Role;
44

55
has es => ( is => 'ro', );
66

7-
has index_name => ( is => 'ro', );
8-
97
1;

Diff for: lib/MetaCPAN/Server/Model/Search.pm

+1-4
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,7 @@ has search => (
1515
handles => [qw( search_for_first_result search_web )],
1616
default => sub {
1717
my $self = shift;
18-
return MetaCPAN::Query::Search->new(
19-
es => $self->es,
20-
index_name => $self->index,
21-
);
18+
return MetaCPAN::Query::Search->new( es => $self->es, );
2219
},
2320
);
2421

Diff for: t/model/search.t

+1-4
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,7 @@ use Test::More;
1010

1111
# Just use this to get an es object.
1212
my $server = MetaCPAN::TestServer->new;
13-
my $search = MetaCPAN::Query::Search->new(
14-
es => $server->es_client,
15-
index_name => 'cpan',
16-
);
13+
my $search = MetaCPAN::Query::Search->new( es => $server->es_client, );
1714

1815
ok( $search, 'search' );
1916

Diff for: t/query/release.t

+1-3
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@ use MetaCPAN::Server::Test ();
88
use Test::More;
99

1010
my $query = MetaCPAN::Query::Release->new(
11-
es => MetaCPAN::Server::Test::model->es(),
12-
index_name => 'cpan',
13-
);
11+
es => MetaCPAN::Server::Test::model->es(), );
1412

1513
is( $query->_get_latest_release('DoesNotExist'),
1614
undef, '_get_latest_release returns undef when release does not exist' );

Diff for: xt/search_web.t

+1-4
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,7 @@ use Test::More;
1111

1212
# Just use this to get an es object.
1313
my $server = MetaCPAN::TestServer->new;
14-
my $search = MetaCPAN::Query::Search->new(
15-
es => $server->es_client,
16-
index_name => 'cpan',
17-
);
14+
my $search = MetaCPAN::Query::Search->new( es => $server->es_client );
1815

1916
my %tests = (
2017
'anyevent http' => 'AnyEvent::HTTP',

0 commit comments

Comments
 (0)