Search::Typesense::Collection - Collection - CRUD for Typesense collections
version 0.08
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.
$query
Unlike other methods, if we find nothing, we still return the data structure (instead of undef instead of a 404 exception).
undef
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!
Curtis "Ovid" Poe <ovid@allaroundtheworld.fr>
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.
To install Search::Typesense, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Search::Typesense
CPAN shell
perl -MCPAN -e shell install Search::Typesense
For more information on module installation, please visit the detailed CPAN module installation guide.