onstage2426/fuzor
Composer 安装命令:
composer require onstage2426/fuzor
包简介
Dependency-free full-text search for PHP. BM25 ranking, fuzzy and boolean modes, search-as-you-type prefix matching, stopword filtering and Snowball stemming for 62 languages, snippet extraction and result highlighting — one SQLite file, zero infrastructure.
关键字:
README 文档
README
About
Fuzor is a dependency-free full-text search library for PHP. It tokenises your documents, stores an inverted index in a single SQLite file, and scores results with Okapi BM25 — no external services required.
- BM25 ranked search with automatic typo tolerance
- Boolean search with AND / OR / NOT operators
- Faceted filtering, per-value counts, and facet value search
- Search-as-you-type prefix matching and phrase search
- Stopword filtering and Snowball stemming for 62 languages
- Result highlighting and snippet extraction
- One SQLite file per index — zero infrastructure
Installation
composer require onstage2426/fuzor
Requirements: PHP 8.5+, SQLite 3.46.0+
Usage
use Fuzor\Index; use Fuzor\SchemaConfig; use Fuzor\SearchOptions; use Fuzor\FacetRange; use Fuzor\FacetSearchQuery; // Create an index — declare facetable fields at creation time $index = new Index('/path/to/products.db', schema: new SchemaConfig( language: 'en', facetFields: ['type', 'price'], )); $index->insert([ ['id' => 1, 'title' => 'Fast sedan', 'body' => 'City car with great fuel economy.', 'type' => 'sedan', 'price' => 24900], ['id' => 2, 'title' => 'Off-road SUV', 'body' => 'Built for adventure and any terrain.', 'type' => 'suv', 'price' => 41500], ['id' => 3, 'title' => 'Electric coupe', 'body' => 'Zero emissions and instant torque.', 'type' => 'coupe', 'price' => 58000], ]); // BM25 ranked search — typo tolerance fires automatically on words ≥ 5 chars $result = $index->search('economi'); // Boolean search $result = $index->searchBoolean('sedan or coupe -electric'); // Faceted search — filter by attribute, count values $result = $index->search('car', new SearchOptions( filter: ['type' => ['sedan', 'suv'], 'price' => FacetRange::max(45000)], facets: ['type'], )); $result->hits; // documents in relevance order $result->facetDistribution; // ['type' => ['sedan' => 1, 'suv' => 1]] // Facet value search — autocomplete a filter dropdown $facetResult = $index->facetSearch(new FacetSearchQuery( facetName: 'type', facetQuery: 'se', // prefix-match facet values: matches 'sedan' query: 'car', // restrict to docs matching this FTS query )); foreach ($facetResult as $hit) { echo $hit['value'] . ': ' . $hit['count'] . "\n"; // "sedan: 1" }
Documentation
- Indexing — creating indexes, inserting, updating, facet fields, rebuild, snapshots
- Search — BM25, boolean, phrases, typo tolerance, synonyms, facets, sorting, distinct
- Language — stopwords, stemming, CJK/Thai n-grams
- Formatting — result highlighting and snippet extraction
- Document store — storing and retrieving raw documents
- Tuning — BM25 parameters, typo tolerance, field boosting
- Performance — read/write index split, snapshots
- Inspect query — debug the query pipeline
License
MIT — see LICENSE.
onstage2426/fuzor 适用场景与选型建议
onstage2426/fuzor 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 67 次下载、GitHub Stars 达 1, 最近一次更新时间为 2026 年 05 月 26 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「search」 「sqlite」 「tokenizer」 「highlighting」 「multilingual」 「snippet」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 onstage2426/fuzor 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 onstage2426/fuzor 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 onstage2426/fuzor 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Dibi is Database Abstraction Library for PHP
Library emulating the PHP internal reflection using just the tokenized source code.
A Laravel package to retrieve data from Google Search Console
The tenancy/tenancy database driver for sqlite
Indexed Search Autocomplete - Extends the TYPO3 Core Extension Indexed_Search searchform with an autocomplete feature.
A program for performing lexical analysis, written in PHP
统计信息
- 总下载量: 67
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 49
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-05-26