Catmandu-Store-OpenSearch

 view release on metacpan or  search on metacpan

lib/Catmandu/Store/OpenSearch/CQL.pm  view on Meta::CPAN

use Catmandu::Util qw(require_package trim);
use CQL::Parser;
use Moo;
use Types::Standard qw(HashRef);
use Types::Common::String qw(NonEmptyStr);
use namespace::clean;
use feature qw(signatures);
no warnings qw(experimental::signatures);

has parser  => (is => 'lazy', init_arg => undef);
has mapping => (is => 'ro', isa => HashRef, required => 1);
has id_key  => (is => 'ro', isa => NonEmptyStr, required => 1);

my $RE_ANY_FIELD         = qr'^(srw|cql)\.(serverChoice|anywhere)$'i;
my $RE_MATCH_ALL         = qr'^(srw|cql)\.allRecords$'i;
my $RE_DISTANCE_MODIFIER = qr'\s*\/\s*distance\s*<\s*(\d+)'i;

sub _build_parser {
    CQL::Parser->new;
}

lib/Catmandu/Store/OpenSearch/Searcher.pm  view on Meta::CPAN

use Moo;
use Cpanel::JSON::XS qw(encode_json);
use Types::Standard qw(Int HashRef InstanceOf);
use namespace::clean;
use feature qw(signatures);
no warnings qw(experimental::signatures);

with 'Catmandu::Iterable';

has bag   => (is => 'ro', isa => InstanceOf['Catmandu::Store::OpenSearch::Bag'], required => 1);
has query => (is => 'ro', isa => HashRef, required => 1);
has start => (is => 'ro', isa => Int, required => 1);
has limit => (is => 'ro', isa => Int, required => 1);
has total => (is => 'ro', isa => Int);
has sort  => (is => 'lazy');

sub _build_sort {
    [{_id => {order => 'asc'}}];
}

sub generator ($self) {



( run in 0.889 second using v1.01-cache-2.11-cpan-5f2e87ce722 )