File tree Expand file tree Collapse file tree 5 files changed +20
-31
lines changed Expand file tree Collapse file tree 5 files changed +20
-31
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ use Mojo::Base 'Mojolicious::Plugin';
55use Carp ();
66
77# Models from the catalyst app
8- use MetaCPAN::Model ::Search ();
8+ use MetaCPAN::Query ::Search ();
99
1010# New models
1111use MetaCPAN::API::Model::Cover ();
@@ -21,9 +21,9 @@ has download => sub {
2121
2222has search => sub {
2323 my $self = shift ;
24- return MetaCPAN::Model ::Search-> new(
25- es => $self -> app-> es,
26- index => ' cpan' ,
24+ return MetaCPAN::Query ::Search-> new(
25+ es => $self -> app-> es,
26+ index_name => ' cpan' ,
2727 );
2828};
2929
Original file line number Diff line number Diff line change 1- package MetaCPAN::Model ::Search ;
1+ package MetaCPAN::Query ::Search ;
22
33use MetaCPAN::Moose;
44
@@ -10,18 +10,7 @@ use MetaCPAN::Types::TypeTiny qw( Object Str );
1010use MetaCPAN::Util qw( single_valued_arrayref_to_scalar true false ) ;
1111use MooseX::StrictConstructor;
1212
13- has es => (
14- is => ' ro' ,
15- isa => Object,
16- handles => { _run_query => ' search' , },
17- required => 1,
18- );
19-
20- has index => (
21- is => ' ro' ,
22- isa => Str,
23- required => 1,
24- );
13+ with ' MetaCPAN::Query::Role::Common' ;
2514
2615const my $RESULTS_PER_RUN => 200;
2716const my @ROGUE_DISTRIBUTIONS => qw(
@@ -368,7 +357,7 @@ sub build_query {
368357
369358sub run_query {
370359 my ( $self , $type , $es_query ) = @_ ;
371- return $self -> _run_query (
360+ return $self -> es -> search (
372361 index => $self -> index ,
373362 type => $type ,
374363 body => $es_query ,
Original file line number Diff line number Diff line change @@ -4,20 +4,20 @@ use strict;
44use warnings;
55
66use Moose;
7- use MetaCPAN::Model ::Search ();
7+ use MetaCPAN::Query ::Search ();
88
99extends ' MetaCPAN::Server::Model::CPAN' ;
1010
1111has search => (
1212 is => ' ro' ,
13- isa => ' MetaCPAN::Model ::Search' ,
13+ isa => ' MetaCPAN::Query ::Search' ,
1414 lazy => 1,
1515 handles => [qw( search_for_first_result search_web ) ],
1616 default => sub {
1717 my $self = shift ;
18- return MetaCPAN::Model ::Search-> new(
19- es => $self -> es,
20- index => $self -> index ,
18+ return MetaCPAN::Query ::Search-> new(
19+ es => $self -> es,
20+ index_name => $self -> index ,
2121 );
2222 },
2323);
Original file line number Diff line number Diff line change @@ -2,17 +2,17 @@ use strict;
22use warnings;
33use lib ' t/lib' ;
44
5- use MetaCPAN::Model ::Search ();
5+ use MetaCPAN::Query ::Search ();
66use MetaCPAN::TestServer ();
77use MetaCPAN::Util qw( true false) ;
88use Test::Deep qw( cmp_deeply ignore ) ;
99use Test::More;
1010
1111# Just use this to get an es object.
1212my $server = MetaCPAN::TestServer-> new;
13- my $search = MetaCPAN::Model ::Search-> new(
14- es => $server -> es_client,
15- index => ' cpan' ,
13+ my $search = MetaCPAN::Query ::Search-> new(
14+ es => $server -> es_client,
15+ index_name => ' cpan' ,
1616);
1717
1818ok( $search , ' search' );
Original file line number Diff line number Diff line change @@ -5,15 +5,15 @@ use lib 't/lib';
55# USE `bin/prove_live` to run this
66# READ the README.txt in this dir
77
8- use MetaCPAN::Model ::Search ();
8+ use MetaCPAN::Query ::Search ();
99use MetaCPAN::TestServer ();
1010use Test::More;
1111
1212# Just use this to get an es object.
1313my $server = MetaCPAN::TestServer-> new;
14- my $search = MetaCPAN::Model ::Search-> new(
15- es => $server -> es_client,
16- index => ' cpan' ,
14+ my $search = MetaCPAN::Query ::Search-> new(
15+ es => $server -> es_client,
16+ index_name => ' cpan' ,
1717);
1818
1919my %tests = (
You can’t perform that action at this time.
0 commit comments