]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/src/perlmods/OpenILS/Application/Storage/Driver/Pg/cdbi.pm
fixing case of only negated words
[Evergreen.git] / Open-ILS / src / perlmods / 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 Class::DBI;
5         package Class::DBI;
6
7         sub search_fts {
8                 my $self = shift;
9                 my @args = @_;
10
11                 if (ref($args[-1]) eq 'HASH' && @args > 1) {
12                         $args[-1]->{_placeholder} = "to_tsquery('default',?)";
13                 } else {
14                         push @args, {_placeholder => "to_tsquery('default',?)"};
15                 }
16                 
17                 $self->_do_search("@@"  => @args);
18         }
19
20         sub search_regex {
21                 my $self = shift;
22                 my @args = @_;
23                 $self->_do_search("~*"  => @args);
24         }
25
26         sub search_ilike {
27                 my $self = shift;
28                 my @args = @_;
29                 $self->_do_search("ILIKE"  => @args);
30         }
31
32 }
33
34 1;