Code Monkey home page Code Monkey logo

typesense-dart's Introduction

Typesense

pub package github actions status pub likes pub points

Dart client library for accessing the HTTP API of Typesense search engine.

Note: This package is still under development. Some existing APIs might change or new APIs might be available in the future.

Installation

Add typesense as a dependency in your pubspec.yaml file.

dependencies:
  typesense: ^0.5.1

Usage

Read the documentation here: https://typesense.org/docs/api/

Tests are also a good place to know how the library works internally: test

Note: When using this library in a user-facing app, please be sure to use an API Key that only allows search operations instead of the master API key. See keys.dart for an example of how to generate a search only API key.

See Configuration class for a list of all client configuration options.

Examples

import 'dart:io';

import 'package:typesense/typesense.dart';


void main() async {
  // Replace with your configuration
  final host = InternetAddress.loopbackIPv4.address, protocol = Protocol.http;
  final config = Configuration(
    // Api key
    'xyz',
    nodes: {
      Node(
        protocol,
        host,
        port: 7108,
      ),
      Node.withUri(
        Uri(
          scheme: 'http',
          host: host,
          port: 8108,
        ),
      ),
      Node(
        protocol,
        host,
        port: 9108,
      ),
    },
    numRetries: 3, // A total of 4 tries (1 original try + 3 retries)
    connectionTimeout: const Duration(seconds: 2),
  );

  final client = Client(config);

  final searchParameters = {
    'q': 'stark',
    'query_by': 'company_name',
    'filter_by': 'num_employees:>100',
    'sort_by': 'num_employees:desc'
  };

  await client.collection('companies').documents.search(searchParameters);
}

The examples that walk you through on how to use the client: main.dart

Make sure to README beforehand.

Compatibility

Typesense Server typesense-dart
>= v0.24.0 >= v0.5.0
>= v0.22.0 >= v0.3.0
>= v0.21.0 >= v0.1.1

Contributing

Visit CONTRIBUTING.md

Credits

This library is authored and maintained by our awesome community of contributors:

typesense-dart's People

Contributors

happy-san avatar harisarang avatar mafreud avatar jasonbosco avatar sanekyy 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.