Sphinx-Search
view release on metacpan or search on metacpan
lib/Sphinx/Search.pm view on Meta::CPAN
# SphinxQL query
$results = $sph->SphinxQL("SELECT * FROM myindex WHERE MATCH('search terms')");
=head1 DESCRIPTION
This is the Perl API client for the Sphinx open-source SQL full-text indexing
search engine, L<http://www.sphinxsearch.com>.
Since 0.9.9, Sphinx supports a native MySQL-protocol client, i.e. DBI with DBD::mysql. That is, you can configure the server to have a mysql41 listening port and then simply do
my $dbh = DBI->connect('dbi:mysql:host=127.0.0.1;port=9306;mysql_enable_utf8=1') or die "Failed to connect via DBI";
my $sth = $dbh->prepare_cached("SELECT * FROM myindex WHERE MATCH('search terms')");
$sth->execute();
while (my $row = $sth->fetchrow_arrayref) {
... # Collect results
}
The DBI client turns out to be significantly (about 5x) faster than this pure-Perl API. You should probably be using that instead.
This module also supports SphinxQL queries, with the small advantage that you can use either the standard API or the SphinxQL API over the one port (i.e. the searchd server does not need to be configured with a mysql41 listening port).
( run in 0.330 second using v1.01-cache-2.11-cpan-1dc43b0fbd2 )