NAME

Search::Typesense::Document - CRUD for Typesense documents

SYNOPSIS

my $typesense = Search::Typesense->new(
    host    => $host,
    api_key => $key,
);
my $documents = $typesense->documents;

The instantiation of this module is for internal use only. The methods are public.

create

my $document = $typesense->documents->create($collection, \%data);

Arguments and response as shown at https://typesense.org/docs/0.19.0/api/#index-document

upsert

my $document = $typesense->documents->upsert($collection, \%data);

Arguments and response as shown at https://typesense.org/docs/0.19.0/api/#upsert

update

my $document = $typesense->documents->update($collection, $document_id, \%data);

Arguments and response as shown at https://typesense.org/docs/0.19.0/api/#update-document

delete

my $document = $typesense->documents->delete($collection_name, $document_id);

Arguments and response as shown at https://typesense.org/docs/0.19.0/api/#delete-document

export

my $export = $typesense->documents->export($collection_name);

Response as shown at https://typesense.org/docs/0.19.0/api/#export-documents

(An arrayref of hashrefs)

import

 my $response = $typesense->documents->import(
   $collection_name,
   $action,
   \@documents,
);

Response as shown at https://typesense.org/docs/0.19.0/api/#import-documents

$action must be one of create, update, or upsert.