Coder Social home page Coder Social logo

michael-rodriguez22 / meilisearch-dart Goto Github PK

View Code? Open in Web Editor NEW

This project forked from meilisearch/meilisearch-dart

0.0 0.0 0.0 321 KB

The Meilisearch API client written for Dart

Home Page: https://www.meilisearch.com

License: MIT License

Dart 98.06% Shell 1.94%

meilisearch-dart's Introduction

Meilisearch

Meilisearch Dart

Pub Version GitHub Workflow Status License Bors enabled

โšก The Meilisearch API client written in Dart

Meilisearch Dart is the Meilisearch API client for Dart and Flutter developers.

Meilisearch is an open-source search engine. Discover what Meilisearch is!

Table of Contents

๐Ÿ“– Documentation

See our Documentation or our API References.

๐Ÿ”ง Installation

You can install the meilisearch package by adding a few lines into pubspec.yaml file.

dependencies:
  meilisearch: ^0.5.1

Then open your terminal and update dart packages.

pub get

Run Meilisearch

There are many easy ways to download and run a Meilisearch instance.

For example, using the curl command in your Terminal:

#Install Meilisearch
curl -L https://install.meilisearch.com | sh

# Launch Meilisearch
./meilisearch --master-key=masterKey

NB: you can also download Meilisearch from Homebrew or APT or even run it using Docker.

๐Ÿš€ Getting Started

Add Documents

import 'package:meilisearch/meilisearch.dart';

void main() async {
  var client = MeiliSearchClient('http://127.0.0.1:7700', 'masterKey');

  // An index is where the documents are stored.
  var index = client.index('movies');

  const documents = [
    { id: 1, title: 'Carol', genres: ['Romance', 'Drama'] },
    { id: 2, title: 'Wonder Woman', genres: ['Action', 'Adventure'] },
    { id: 3, title: 'Life of Pi', genres: ['Adventure', 'Drama'] },
    { id: 4, title: 'Mad Max: Fury Road', genres: ['Adventure', 'Science Fiction'] },
    { id: 5, title: 'Moana', genres: ['Fantasy', 'Action']},
    { id: 6, title: 'Philadelphia', genres: ['Drama'] },
  ]

  // If the index 'movies' does not exist, Meilisearch creates it when you first add the documents.
  var task = await index.addDocuments(documents); // => { "uid": 0 }
}

With the uid, you can check the status (enqueued, processing, succeeded or failed) of your documents addition using the task.

Basic Search

// Meilisearch is typo-tolerant:
var result = await index.search('carlo');

print(result.hits);

JSON Output:

[
  {
    "id": 1,
    "title": "Carol",
    "genres": ["Romance", "Drama"]
  }
]

Custom Search

All the supported options are described in the search parameters section of the documentation.

var result = await index.search(
  'carol',
  attributesToHighlight: ['title'],
);

JSON output:

{
    "hits": [
        {
            "id": 1,
            "title": "Carol",
            "_formatted": {
                "id": 1,
                "title": "<em>Carol</em>"
            }
        }
    ],
    "offset": 0,
    "limit": 20,
    "processingTimeMs": 0,
    "query": "carol"
}

๐Ÿค– Compatibility with Meilisearch

This package only guarantees the compatibility with the version v0.25.0 of Meilisearch.

๐Ÿ’ก Learn More

The following sections may interest you:

โš™๏ธ Development Workflow and Contributing

Any new contribution is more than welcome in this project!

If you want to know more about the development workflow or want to contribute, please visit our contributing guidelines for detailed instructions!


Meilisearch provides and maintains many SDKs and Integration tools like this one. We want to provide everyone with an amazing search experience for any kind of project. If you want to contribute, make suggestions, or just know what's going on right now, visit us in the integration-guides repository.

meilisearch-dart's People

Contributors

curquiza avatar bors[bot] avatar themisir avatar brunoocasali avatar meili-bot avatar alallema avatar sanders41 avatar sayam06 avatar reginaalyssa 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.