]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg/cdbi.pm
Merge branch 'master' of git.evergreen-ils.org:Evergreen-DocBook into doc_consolidati...
[Evergreen.git] / Open-ILS / src / perlmods / lib / OpenILS / Application / Storage / Driver / Pg / cdbi.pm
1 { # Based on the change to Class::DBI in OpenILS::Application::Storage.  This will
2   # allow us to use TSearch2 via a simple cdbi "search" interface.
3         #-------------------------------------------------------------------------------
4         use UNIVERSAL::require; 
5         BEGIN {                 
6                 'Class::DBI::Frozen::301'->use or 'Class::DBI'->use or die $@;
7         }     
8         package Class::DBI;
9
10         sub search_fts {
11                 my $self = shift;
12                 my @args = @_;
13
14                 if (ref($args[-1]) eq 'HASH' && @args > 1) {
15                         $args[-1]->{_placeholder} = "to_tsquery('default',?)";
16                 } else {
17                         push @args, {_placeholder => "to_tsquery('default',?)"};
18                 }
19                 
20                 $self->_do_search("@@"  => @args);
21         }
22
23         sub search_regex {
24                 my $self = shift;
25                 my @args = @_;
26                 $self->_do_search("~*"  => @args);
27         }
28
29         sub search_ilike {
30                 my $self = shift;
31                 my @args = @_;
32                 $self->_do_search("ILIKE"  => @args);
33         }
34
35 }
36
37 1;