| 1 | #!/usr/bin/perl | ||||||||||
| 2 | |||||||||||
| 3 | package KiokuDB::Backend::Role::Query::GIN; | ||||||||||
| 4 | 1 | ▶ | use Moose::Role; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | 1 | ▶ | use namespace::clean -except => 'meta'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | 1 | with qw( | |||||||||
| 9 | Search::GIN::Extract | ||||||||||
| 10 | Search::GIN::Driver | ||||||||||
| 11 | ); | ||||||||||
| 12 | |||||||||||
| 13 | 1 | has distinct => ( | |||||||||
| 14 | isa => "Bool", | ||||||||||
| 15 | is => "rw", | ||||||||||
| 16 | default => 0, # FIXME what should the default be? | ||||||||||
| 17 | ); | ||||||||||
| 18 | |||||||||||
| 19 | sub search { | ||||||||||
| 20 | 3 | ▶ | my ( $self, $query, @args ) = @_; | ||||||||
|
Subroutine
search: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||
| 21 | |||||||||||
| 22 | 3 | my %args = ( | |||||||||
| 23 | distinct => $self->distinct, | ||||||||||
| 24 | @args, | ||||||||||
| 25 | ); | ||||||||||
| 26 | |||||||||||
| 27 | 3 | my @spec = $query->extract_values($self); | |||||||||
| 28 | |||||||||||
| 29 | 3 | my $ids = $self->fetch_entries(@spec); | |||||||||
| 30 | |||||||||||
| 31 | 3 | ▶ | $ids = unique($ids) if $args{distinct}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 32 | |||||||||||
| 33 | 3 | ▶ | return $ids->filter(sub {[ $self->get(@$_) ]}); | ||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||
| 34 | } | ||||||||||
| 35 | |||||||||||
| 36 | sub search_filter { | ||||||||||
| 37 | 3 | ▶ | my ( $self, $objects, $query, @args ) = @_; | ||||||||
|
Subroutine
search_filter: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 38 | 3 | ▶ | return $objects->filter(sub { [ grep { $query->consistent($self, $_) } @$_ ] }); | ||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||
| 39 | } | ||||||||||
| 40 | |||||||||||
| 41 | 1 | __PACKAGE__ | |||||||||
| 42 | |||||||||||
| 43 | __END__ | ||||||||||