搜尋套件、儲存庫與 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 組件需要拼寫容錯
  • 帶有搜尋功能的原型和MVP

使用建議

  • 不適合大規模伺服器端搜尋
  • 僅限客戶端使用
  • 不支援進階排名或評分
  • 最適合中小型資料集
  • 無內建快取或非同步處理

原始 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 項

原始碼儲存庫

使用此套件的專案

暫無相關資料。