NAME Search::Typesense - Perl interface to Typesense search engine. SYNOPSIS my $typesense = Search::Typesense->new( use_https => $bool, host => $host, port => $port, api_key => $key, ); my $results = $typesense->search( $collection_name, { q => 'Search String' }, ); if ( $results->{found} ) { foreach my $hit ( @{ $results->{hits} } ) { ...; } } DESCRIPTION This is a simple interface to the Typesense search engine. Most methods will do one of three things: * Return results as defined in the Typesense documentation (listed per section) * Return nothing if Typesense returns a 404. * "croak" if Typesense returns an error. VERSION Version 0.02 CONSTRUCTOR The constructor takes a list (or hashref) of key/value pairs. my $typesense = Search::Typesense->new( use_https => $bool, host => $host, port => $port, api_key => $key, ); "api_key" The api key to which will be sent as the "X-TYPESENSE-API-KEY" header. "host" The hostname to connect to. "port" Optional port number to connect to. Defaults to 8108 if not supplied. "use_https" Optional boolean. Whether or not to connect to Typesense over https. Default true. METHODS "assert_is_running" $typesense->assert_is_running; This does nothing if we can connect to Typesense. Otherwise, this method will "croak" with a message explaining the error. "get_collections" if ( my $collections = $typesense->get_collections ) { # returns all collections } if ( my $collections = $typesense->get_collections($collection_name) ) { # returns collection matching $collection_name, if any } Response shown at "delete_collection" my $response = $typesense->delete_collection($collection_name); Response shown at "create_collection" my $collection = $typesense->create_collection(\%definition); Arguments and response as shown at "create_document" my $document = $typesense->create_document($collection, \%data); Arguments and response as shown at "upsert_document" my $document = $typesense->upsert_document($collection, \%data); Arguments and response as shown at "update_document" my $document = $typesense->update_document($collection, $document_id, \%data); Arguments and response as shown at "delete_document" my $document = $typesense->delete_document($collection_name, $document_id); Arguments and response as shown at "search" my $results = $typesense->search($collection_name, {q => 'London'}); The parameters for $query are defined at , 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). "export_documents" my $export = $typesense->export_documents($collection_name); Response as shown at (An arrayref of hashrefs) "import_documents" my $response = $typesense->import_documents( $collection_name, $action, \@documents, ); Response as shown at $action must be one of "create", "update", or "upsert". "delete_all_collections" $typesense->delete_all_collections; Deletes everything from Typsense. Use with caution! AUTHOR Curtis "Ovid" Poe, "" BUGS Please report any bugs or feature requests to "bug-search-typesense at rt.cpan.org", or through the web interface at . I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. SUPPORT You can find documentation for this module with the perldoc command. perldoc Search::Typesense You can also look for information at: * Github Repo * Issue Tracker * Search CPAN ACKNOWLEDGEMENTS Thanks for Sebastian Reidel and Matt Trout for feedback. LICENSE AND COPYRIGHT This software is Copyright (c) 2021 by Curtis "Ovid" Poe. This is free software, licensed under: The Artistic License 2.0 (GPL Compatible)