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

插件详情v2.0.3

woozy_search

一个基于编辑距离的超级简单且轻量级的客户端模糊搜索库。

AndroidiOSWebmacOSWindowsLinux
近 30 天下载
1400
喜欢数
24
Pub 分数
150

安装插件

flutter pub add woozy_search

插件介绍

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

Woozy Search 是一个轻量级的客户端模糊搜索库,适用于 Flutter 应用程序,使用 Levenshtein 距离来匹配存在轻微差异的字符串。即使用户输入拼写错误或使用部分输入,也能实现快速且准确的搜索结果。设计简洁,设置简单,可在所有主要平台(包括 Android、iOS、Web、macOS、Windows 和 Linux)上运行。非常适合用于增强搜索栏和灵活匹配列表的用户体验。

适合场景

  • 列表视图中的实时搜索
  • 容错文本匹配
  • 自动完成建议
  • 本地过滤大型数据集
  • 简单 UI 搜索组件
  • 增强搜索界面的可访问性

主要特点

  • 基于编辑距离
  • 最小设置和配置
  • 跨平台兼容性
  • 轻便且快速
  • 仅客户端
  • 无外部依赖

适合对象

  • 寻求简单模糊搜索的开发者
  • 需要本地搜索但无需后端的应用
  • 项目优先考虑性能和大小
  • UI 组件需要拼写容错
  • 带有搜索功能的原型和最小可行产品

使用建议

  • 不适合大规模服务器端搜索
  • 仅限客户端使用
  • 不支持高级排名或评分
  • 最适合中小型数据集
  • 无内置缓存或异步处理

原始 README

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

Woozy Search

A super simple and lightweight client-side fuzzy-search library based on Levenshtein distance.

Usage

dependencies:
  woozy_search: '>=2.0.2 <3.0.0'

Basic Usage

import 'package:woozy_search/woozy_search.dart';

main() {
  final woozy = Woozy();
  woozy.addEntries(['basketball', 'badminton', 'skating']);
  final output = woozy.search('badmi');
  output.forEach((element) => print(' - ${element}'));
}

Output:

 - text: badminton, score: 0.56
 - text: basketball, score: 0.20
 - text: skating, score: 0.14

With Associate Values

Associate value can be anything, integers, UUIDs, text, etc. As an example, we use a name and their phone number here.

import 'package:woozy_search/woozy_search.dart';

main() {
  final woozy = new Woozy();
  woozy.addEntry('John Doe', value: "+1 210-269-0117");
  woozy.addEntry('Nate Humphrey', value: "+1 (416) 527-4927");
  woozy.addEntry('Serena Waldorf', value: "+ 1 914-514-7901");
  final output = woozy.search('humphray');
  output.forEach((element) => print(' - ${element}'));
}

Output:

 - text: Nate Humphrey, score: 0.88, value: +1 (416) 527-4927
 - text: Serena Waldorf, score: 0.13, value: + 1 914-514-7901
 - text: John Doe, score: 0.13, value: +1 210-269-0117

With Search Output Limit

Limit the number of search result to return. It is defaulted to 10, but can be overwritten.

import 'package:woozy_search/woozy_search.dart';
  
main() {
  final woozy = Woozy(limit: 2);
  woozy.setEntries(List.filled(100, 'foo'));
  final output = woozy.search('f');
  output.forEach((element) => print(' - ${element}'));
}

Output:

 - text: foo, score: 0.33
 - text: foo, score: 0.33

With Case Sensitive

main() {
  final woozy = Woozy(caseSensitive: true);
  woozy.setEntries(['FOO', 'boo']);
  final output = woozy.search('foo');
  output.forEach((element) => print(' - ${element}'));
}

Output:

 - text: boo, score: 0.67
 - text: FOO, score: 0.00

Features and bugs

Please file feature requests and bugs at the issue tracker.

所属分类

依赖

依赖清单 1 项

源码仓库

使用此插件的项目

暂无相关数据。