File tree Expand file tree Collapse file tree 5 files changed +12
-23
lines changed Expand file tree Collapse file tree 5 files changed +12
-23
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,7 +21,7 @@ has download => sub {
2121
2222has search => sub {
2323 my $self = shift ;
24- return MetaCPAN::Model ::Search-> new(
24+ return MetaCPAN::Query ::Search-> new(
2525 es => $self -> app-> es,
2626 index => ' cpan' ,
2727 );
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,18 +4,18 @@ 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(
18+ return MetaCPAN::Query ::Search-> new(
1919 es => $self -> es,
2020 index => $self -> index ,
2121 );
Original file line number Diff line number Diff line change @@ -2,15 +2,15 @@ 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(
13+ my $search = MetaCPAN::Query ::Search-> new(
1414 es => $server -> es_client,
1515 index => ' cpan' ,
1616);
Original file line number Diff line number Diff line change @@ -5,13 +5,13 @@ 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(
14+ my $search = MetaCPAN::Query ::Search-> new(
1515 es => $server -> es_client,
1616 index => ' cpan' ,
1717);
You can’t perform that action at this time.
0 commit comments