패키지, 저장소 및 앱 카테고리 검색

패키지 상세v0.19.0

meilisearch

Meilisearch Dart는 Dart 및 Flutter 개발자를 위한 Meilisearch API 클라이언트입니다.

AndroidiOSWebmacOSWindowsLinux
30일 다운로드
4.2천
좋아요
65
Pub 점수
140

패키지 설치

flutter pub add meilisearch

패키지 개요

공개 정보를 바탕으로 생성한 선택 가이드입니다.

Meilisearch Dart는 Dart 및 Flutter 애플리케이션용 가벼운 API 클라이언트로, 빠르고 관련성 있으며 사용자 정의 가능한 검색 엔진인 Meilisearch와 원활하게 통합할 수 있습니다. 개발자는 앱에서 실시간 검색을 수행하고 인덱스를 관리하며 문서 업데이트를 직접 처리할 수 있습니다. 이 클라이언트는 Android, iOS, Web, macOS, Windows, Linux 등 주요 플랫폼을 모두 지원하여 크로스플랫폼 검색 기능에 이상적입니다. 직관적인 메서드와 최소한의 설정으로 어떤 Flutter 프로젝트에도 강력한 검색 기능을 쉽게 추가할 수 있습니다.

사용 사례

  • 모바일 앱에서의 실시간 검색
  • Flutter에서 인덱스 관리
  • 다중 플랫폼에서의 전체 텍스트 검색
  • 검색 제안 및 자동 완성
  • 문서 인덱싱 및 업데이트
  • 크로스 플랫폼 검색 구현

주요 기능

  • 검색 작업을 위한 간단한 API
  • 모든 주요 플랫폼을 지원합니다
  • 실시간 검색 결과
  • 간편한 인덱스 및 문서 처리
  • 가볍고 빠름
  • 내장 오류 처리

적합한 대상

  • 검색 기능이 필요한 플러터 개발자
  • 빠른 전체 텍스트 검색이 필요한 앱
  • 여러 플랫폼을 대상으로 하는 프로젝트
  • 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 개

소스 저장소

이 패키지를 사용하는 프로젝트