NAME

AnyEvent::Groonga - Groonga client for AnyEvent

SYNOPSIS

use AnyEvent::Groonga;

my $groonga = AnyEvent::Groonga->new(
  protocol => 'http',
  host     => 'localhost,
  port     => '10041',
);

# blocking interface
my $result = $groonga->call(select => {
  table          => "Site",
  query          => 'title:@test',
  output_columns => [qw(_id _score title)],
  sortby         => '_score',
})->recv;

# result is AnyEvent::Groonga::Result::Select object
print $result->dump;

# non-blocking interface
$groonga->call(select => {
  table          => "Site",
  query          => 'title:@test',
  output_columns => [qw(_id _score title)],
  sortby         => '_score',
})->cb(
  sub {
    my $result = $_[0]->recv; 
  }
);

print Dumper $result->items;

DESCRIPTION

This is groonga client module for AnyEvent applications.

groonga is an open-source fulltext search engine and column store.

SEE ALSO

http://groonga.org/

METHOD

new (%options)

Create groonga client object.

my $groonga = AnyEvent::Groonga->new(
  protocol => 'http',
  host     => 'localhost,
  port     => '10041',
);

Available options are:

protocol => 'http|gqtp|local_db'

groonga-server speaks http and gqtp protocol (groonga original protocol).

And it works for local database file, too.

host
port
groonga_path

It is necessary if you set the protocol as gqtp or local_db.

database_path

It is necessary if you set the protocol as local_db.

call ($command => \%args)

Call groonga command named $command with %args parameters.

It returns AnyEvent condvar object for response.

# blocking interface
my $result = $groonga->call(select => {
  table          => "Site",
  query          => 'title:@test',
  output_columns => [qw(_id _score title)],
  sortby         => '_score',
})->recv;

# result is AnyEvent::Groonga::Result::Select object
print $result->dump;

# non-blocking interface
$groonga->call(select => {
  table          => "Site",
  query          => 'title:@test',
  output_columns => [qw(_id _score title)],
  sortby         => '_score',
})->cb(
  sub {
    my $result = $_[0]->recv; 
  }
);

Available commands are:

cache_limit
check
clearlock
column_create
column_list
column_remove
define_selector
defrag
delete
dump
load
log_level
log_put
log_reopen
quit
select
shutdown
status
suggest
table_create
table_list
table_remove
view_add

See Groonga's official site. http://groonga.org/

AUTHOR

Takeshi Miki <miki@cpan.org>

LICENSE

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.