Coder Social home page Coder Social logo

search-typesense's Introduction

NAME

Search::Typesense - Perl interface to the Typesense search engine

VERSION

version 0.08

SYNOPSIS

my $typesense = Search::Typesense->new(
    host      => $host,    # required
    api_key   => $key,     # required
    port      => $port,    # defaults to 8108
    use_https => $bool,    # defaults to true
);

my $results = $typesense->search(
    $collection_name,
    { q => 'Search String' },
);
if ( $results->{found} ) {
    foreach my $hit ( @{ $results->{hits} } ) {
        ...;
    }
}

Check here for a comparison to ElasticSearch and similar technologies.

DESCRIPTION

ALPHA CODE. The interface can and will change without warning.

This is an 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.

CONSTRUCTOR

The constructor takes a list (or hashref) of key/value pairs.

my $typesense = Search::Typesense->new(
    host      => $host,    # required
    api_key   => $key,     # required
    port      => $port,    # defaults to 8108
    use_https => $bool,    # defaults to true
);

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

For CRUD operations on collections and documents, see the documentation for collections (Search::Typesense::Collection) and documents (Search::Typesense::Document).

collections

my $collections = $typesense->collections;
my $collection  = $collections->get($collection_name);
my $results     = $collections->search($collection_name, {q => 'London'});

Returns an instance of Search::Typesense::Collection for managing Typesense collections.

search

my $results = $typesense->search($collection_name, {q => 'London'});

Shorthand that delegated to $typesense->collections->search(...).

We provide this on the top-level $typesense object because this is the common case.

documents

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

Returns an instance of Search::Typesense::Document for managing Typesense documents.

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.

typesense_version

my $version = $typesense->typesense_version;

Returns an instance of Search::Typesense::Version.

If your version of Typesense is older than 0.8.0, this method will return nothing.

INTERNATIONALIZATION (I18N)

Currently Typesense supports languages that use spaces as a word separator. In the future, a new tokenizer will be added to support languages such as Chinese or Japanese. I do not know the timeframe for this.

AUTHOR

Curtis "Ovid" Poe, <ovid at allaroundtheworld.fr>

BUGS

Please report any bugs or feature requests to https://github.com/Ovid/Search-Typesense/issues. 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:

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)

AUTHOR

Curtis "Ovid" Poe [email protected]

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.

search-typesense's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.