搜索插件、代码仓与 APP 分类

插件详情v0.6.0

typesense

用于访问 Typesense 搜索引擎 HTTP API 的 Dart 客户端库。

AndroidiOSWebmacOSWindowsLinux
近 30 天下载
7810
喜欢数
61
Pub 分数
130

安装插件

flutter pub add typesense

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

一个 Dart 客户端库,可通过其 HTTP API 实现与 Typesense 搜索引擎的无缝集成。它提供了一种简单的方法来执行搜索操作、管理集合以及在 Android、iOS、Web、macOS、Windows 和 Linux 等多个平台上索引文档。专为希望在其 Flutter 应用中实现快速、容错拼写错误的搜索功能的开发者设计,该库抽象了底层 HTTP 交互,同时保持灵活性和高性能。

适合场景

  • Flutter 应用中的实时搜索
  • 全文搜索,支持拼写错误容错
  • 索引和管理文档集合
  • 构建自动补全功能
  • 与现有 Typesense 服务器集成
  • 在移动和网页应用中搜索

主要特点

  • 类型安全的 API 包装器
  • 跨平台兼容性
  • 支持搜索、索引和架构管理
  • 使用 Flutter pub 轻松设置
  • 内置错误处理
  • 轻便高效

适合对象

  • 使用 Typesense 的 Flutter 开发人员
  • 需要快速搜索功能的应用程序
  • 需要跨平台搜索的项目
  • 集成外部搜索引擎的开发者
  • 构建以搜索为重点的用户界面的团队

使用建议

  • 需要一个正在运行的 Typesense 服务器
  • 仅限 HTTP API 功能
  • 不支持离线搜索
  • 依赖网络连接
  • 手动处理复杂的查询逻辑
  • 不适合仅本地搜索需求

原始 README

以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。

Typesense

pub package github actions status pub likes pub points pub downloads

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.6.0

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
>= v30.0 >= v0.6.0
>= 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:

所属分类

依赖

依赖清单 2 项

源码仓库

使用此插件的项目

暂无相关数据。