Re: MySQL fulltext search
[prev]
[thread]
[next]
[Date index for 2004/12/28]
On Tue, 28 Dec 2004 15:44:05 +0000, Tony Bowden <tony-cdbitalk@xxxxx.xxx> wrote:
> On Tue, Dec 28, 2004 at 07:16:39AM -0800, cdbi@xxxxxxxxxxxxx.xxx wrote:
> > Is there anything available to enable fulltext searches via MySQL
> > and CDBI? I didn't find anything via CPAN.
>
> In your base class you could have something like:
>
> sub create_full_text_search {
> my ($class, $name, @cols) = @_;
> my $cols = join ", ", @cols;
> $class->add_constructor($name => "MATCH ($cols) AGAINST ?");
> }
>
Yes, that quite nice. I tested it and here's a minor correction:
sub create_full_text_search {
my ($class, $name, @cols) = @_;
my $cols = join ", ", @cols;
$class->add_constructor($name => "MATCH ($cols) AGAINST (?)");
}
Now what I would really like to do is to be able to combine the full
text search with other columns. That's why AbstractSearch comes to
mind, but it doesn't really confirm to it so nicely. Something like:
my @music = CD::Music->search_where(
artist => [ 'Ozzy', 'Kelly' ],
status => { '!=', 'outdated' },
notes => { 'MATCH', 'pop music', 'IN BOOLEAN MODE' },
);