survos/search-bundle
最新稳定版本:2.8.1
Composer 安装命令:
composer require survos/search-bundle
包简介
Field-driven Symfony UX search adapters, including SQLite FTS5 and PostgreSQL BM25 backends.
README 文档
README
Reusable field-driven search for Symfony applications.
This bundle is intentionally a bridge:
survos/field-bundleremains the source of truth for field metadata.mezcalito/ux-searchprovides the Live Component UI, query state, facets, pagination, and result rendering.survos/search-bundleadds field-driven configuration and database-native BM25 adapters.
Why not ux-search-extras?
The bundle is not only an extension pack for Mezcalito UX Search. The center of gravity is Survos field metadata and portable search backends. survos/search-bundle leaves room for API/Grid/Meili bridges without implying that every feature is tied to Mezcalito internals.
Search From Fields
Create a search class and point it at an entity or DTO class with #[Field] metadata:
use Survos\FolioBundle\Entity\Row; use Survos\SearchBundle\Search\AbstractFieldSearch; use Mezcalito\UxSearchBundle\Attribute\AsSearch; #[AsSearch(index: Row::class, adapter: 'folio_fts')] final class FolioRowSearch extends AbstractFieldSearch { protected function getFieldClass(array $options = []): string { return Row::class; } public function build(array $options = []): void { parent::build($options); $this->setAdapterParameters([ 'table' => 'item', 'ftsTable' => 'item_fts', 'idColumn' => 'id', 'labelColumn' => 'label', 'contentColumns' => ['label', 'dto_data', 'extras'], 'where' => 'core_id = :core', 'params' => ['core' => $options['coreId']], ]); } }
Then render with Mezcalito's component:
<twig:Mezcalito:UxSearch:Layout name="folio_row" :options="{ coreId: core.id }"/>
SQLite FTS5
Configure Mezcalito UX Search with this bundle's adapter:
mezcalito_ux_search: default_adapter: folio_fts adapters: folio_fts: 'sqlite-fts5://folio'
The DSN host is the Doctrine connection name. The adapter uses DBAL and SQLite FTS5:
MATCHfor full-text filteringbm25(fts_table)for score- optional facet counts through normal SQL aggregation
Applications remain responsible for creating and maintaining the FTS5 virtual table. That is deliberate: folios, entities, and denormalized JSON payloads need different indexing strategies.
PostgreSQL BM25
Configure:
mezcalito_ux_search: adapters: pg_bm25: 'postgres-bm25://default'
The first target is pg_textsearch, which provides PostgreSQL BM25 indexes. This bundle keeps the SQL configurable because pg_textsearch and ParadeDB pg_search expose different operators.
Folio Direction
Do not add the search code to folio-bundle. Folio should consume this bundle by:
- Creating/maintaining FTS5 tables next to folio SQLite tables.
- Marking searchable/filterable folio row fields with
#[Field]on DTOs or search-facing row models. - Creating small search classes that bind folio context (
core_id,dto_type) into adapter parameters.
统计信息
- 总下载量: 85
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-05-18