| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
#!/usr/bin/perl |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package KiokuDB::GIN; |
|
4
|
1
|
|
|
1
|
|
1584
|
use Moose::Role; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
11
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
5897
|
use namespace::clean -except => 'meta'; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
11
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
with qw( |
|
9
|
|
|
|
|
|
|
KiokuDB::Backend::Role::Query::GIN |
|
10
|
|
|
|
|
|
|
Search::GIN::Driver |
|
11
|
|
|
|
|
|
|
); |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
has root_only => ( |
|
14
|
|
|
|
|
|
|
isa => "Bool", |
|
15
|
|
|
|
|
|
|
is => "ro", |
|
16
|
|
|
|
|
|
|
default => 1, |
|
17
|
|
|
|
|
|
|
); |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
after insert => sub { |
|
20
|
|
|
|
|
|
|
my ( $self, @entries ) = @_; |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
@entries = grep { $_->root } @entries if $self->root_only; |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
my @idx_entries = grep { $_->has_object } @entries; |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
foreach my $entry ( @idx_entries ) { |
|
27
|
|
|
|
|
|
|
my @keys = $self->extract_values( $entry->object ); |
|
28
|
|
|
|
|
|
|
$self->insert_entry( $entry->id, @keys ); |
|
29
|
|
|
|
|
|
|
} |
|
30
|
|
|
|
|
|
|
}; |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
after delete => sub { |
|
33
|
|
|
|
|
|
|
my ( $self, @ids_or_entries ) = @_; |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
my @ids = map { ref($_) ? $_->id : $_ } @ids_or_entries; |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
$self->remove_ids(@ids); |
|
38
|
|
|
|
|
|
|
}; |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
__PACKAGE__ |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
__END__ |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=pod |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head1 NAME |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
KiokuDB::GIN - Gin assisted recollection |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
use KiokuDB::GIN; |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
This is a generic backend wrapping role that allows adding L<Search::GIN> |
|
57
|
|
|
|
|
|
|
queries to any backend. |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=cut |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
|