NAME
Search::Typesense::Collection - Collection - CRUD for Typesense collections
VERSION
version 0.08
SYNOPSIS
my $typesense = Search::Typesense->new(
host => $host,
api_key => $key,
);
my $collections = $typesense->collections;
The instantiation of this module is for internal use only. The methods are public.
get
if ( my $collections = $typesense->collections->get ) {
# returns all collections
}
if ( my $collections = $typesense->collections->get($collection_name) ) {
# returns collection matching $collection_name, if any
}
Response shown at https://typesense.org/docs/0.19.0/api/#retrieve-collection
search
my $results = $typesense->collections->search($collection_name, {q => 'London'});
The parameters for $query
are defined at https://typesense.org/docs/0.19.0/api/#search-collection, as are the results.
Unlike other methods, if we find nothing, we still return the data structure (instead of undef
instead of a 404 exception).
create
my $collection = $typesense->collections->create(\%definition);
Arguments and response as shown at https://typesense.org/docs/0.19.0/api/#create-collection
delete
my $response = $typesense->collections->delete($collection_name);
Response shown at https://typesense.org/docs/0.19.0/api/#drop-collection
delete_all
$typesense->collections->delete_all;
Deletes everything from Typesense. Use with caution!
AUTHOR
Curtis "Ovid" Poe <ovid@allaroundtheworld.fr>
COPYRIGHT AND LICENSE
This software is copyright (c) 2021 by Curtis "Ovid" Poe.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.