パッケージ、リポジトリ、アプリカテゴリを検索

パッケージ詳細v0.19.0

meilisearch

Meilisearch Dart は、Dart および Flutter 開発者向けの Meilisearch API クライアントです。

AndroidiOSWebmacOSWindowsLinux
30日間ダウンロード
4240
いいね数
65
Pub ポイント
140

パッケージをインストール

flutter pub add meilisearch

パッケージ概要

公開情報に基づく選定ガイドです。参考としてご利用ください。

Meilisearch Dart は、Dart および Flutter アプリケーション向けの軽量な API クライアントであり、高速で関連性が高くカスタマイズ可能な検索エンジンである Meilisearch とのシームレスな統合を可能にします。開発者はアプリからリアルタイム検索を実行し、インデックスを管理し、ドキュメントの更新を処理できます。このクライアントは Android、iOS、Web、macOS、Windows、Linux などすべての主要プラットフォームをサポートしており、クロスプラットフォーム検索機能に最適です。直感的なメソッドと最小限のセットアップで、あらゆる Flutter プロジェクトに強力な検索機能を簡単に追加できます。

用途

  • モバイルアプリにおけるリアルタイム検索
  • Flutter におけるインデックス管理
  • 複数プラットフォーム間のフルテキスト検索
  • 検索の推奨と自動補完
  • ドキュメントのインデックス作成と更新
  • クロスプラットフォーム検索の実装

主な機能

  • 検索操作用のシンプルな API
  • すべての主要なプラットフォームをサポートしています
  • リアルタイム検索結果
  • 簡単なインデックスおよびドキュメントの取り扱い
  • 軽量で高速
  • 組み込みエラー処理

適している対象

  • 検索機能が必要なFlutter開発者
  • 高速なフルテキスト検索を必要とするアプリ
  • 複数のプラットフォームをターゲットにするプロジェクト
  • Meilisearch バックエンドを使用するチーム
  • 低遅延検索を望む開発者

注意事項

  • 実行中のMeilisearchサーバーが必要です
  • 適切なAPIキーの管理が必要です
  • Meilisearchバックエンドに限定
  • 検索クエリのネットワーク依存性
  • オフライン専用の検索には適していません

元の README

関連するソースリポジトリの README 原文のスナップショットです。最新の内容はリポジトリをご覧ください。

Meilisearch

Meilisearch Dart

Meilisearch | Meilisearch Cloud | Documentation | Discord | Roadmap | Website | FAQ

Pub Version GitHub Workflow Status License Code Coverage

⚡ 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. Learn more about Meilisearch.

Table of Contents

📖 Documentation

This readme contains all the documentation you need to start using this Meilisearch SDK.

For general information on how to use Meilisearch—such as our API reference, tutorials, guides, and in-depth articles—refer to our main documentation website.

🔧 Installation

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

dependencies:
  meilisearch: ^0.19.0

Then open your terminal and update dart packages.

pub get
Run Meilisearch

⚡️ Launch, scale, and streamline in minutes with Meilisearch Cloud—no maintenance, no commitment, cancel anytime. Try it free now.

🪨 Prefer to self-host? Download and deploy our fast, open-source search engine on your own infrastructure.

🚀 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, canceled, 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"
}
Custom Search With Filters

If you want to enable filtering, you must add your attributes to the filterableAttributes index setting.

await index.updateFilterableAttributes(['id', 'genres']);

You only need to perform this operation once.

Note that MeiliSearch will rebuild your index whenever you update filterableAttributes. Depending on the size of your dataset, this might take time. You can track the process using the task status.

Then, you can perform the search:

await index.search('wonder', filter: ['id > 1 AND genres = Action']);
{
  "hits": [
    {
      "id": 2,
      "title": "Wonder Woman",
      "genres": ["Action","Adventure"]
    }
  ],
  "offset": 0,
  "limit": 20,
  "estimatedTotalHits": 1,
  "processingTimeMs": 0,
  "query": "wonder"
}

Advanced Configuration

Customizing the dio instance

Meilisearch uses dio internally to send requests, you can provide it with your own interceptors or adapter using the MeiliSearchClient.withCustomDio constructor.

Using MeiliDocumentContainer

The MeiliDocumentContainer<T> class contains meilisearch-specific fields (e.g. rankingScoreDetails, _formatted, matchesPosition, etc...).

We define the mapToContainer() extension to help you quickly opt-in to this class, example:

final res = await index
      .search("hello world")
      .asSearchResult() //or .asPaginatedResult() if using page parameters
      .mapToContainer();

🤖 Compatibility with Meilisearch

This package guarantees compatibility with version v1.x of Meilisearch, but some features may not be present. Please check the issues for more info.

💡 Learn more

The following sections in our main documentation website may interest you:

⚙️ 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.

カテゴリー

依存関係

依存関係一覧 5 件

ソースリポジトリ

このパッケージを使用しているプロジェクト