NAME
Search::Typesense - Perl interface to Typesense search engine.
SYNOPSIS
my $typesense = Search::Typesense->new(
use_https => $bool,
host => $host,
port => $port,
);
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.01
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".
"purge"
$typesense->purge;
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
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)