phpsrprogrammer/bagisto-vector-search
Composer 安装命令:
composer require phpsrprogrammer/bagisto-vector-search
包简介
Open-source semantic (vector) search, autosuggest, and related/up-sell fallback for Bagisto using Qdrant + fastembed (all self-hosted, no paid APIs).
README 文档
README
Open-source semantic (vector) search for Bagisto — 100% self-hosted, no paid APIs.
Stack: Qdrant (vector DB, Apache-2.0) + fastembed running BAAI/bge-small-en-v1.5 (ONNX, CPU) as a small local embedding service.
Features
- Semantic product search — overrides
ProductRepository::getAll()for the storefront search box (query is embedded → nearest vectors → results in relevance order, with category/price filters preserved). Falls back to Bagisto's DB search if the vector service is down. - Category-grouped autosuggest —
GET /vector-suggest?query=returns products grouped by category (name, price, image, attributes) served entirely from the Qdrant payload. - Vector-powered related & up-sell — overrides
/api/products/{id}/relatedand/up-sell: manual admin relations first, gap filled with vector nearest-neighbours (visibility-filtered). - Auto re-index — listens to
catalog.product.create/update/delete.after; keeps the index in sync on every product save.
Requirements
- Qdrant reachable at
VECTOR_QDRANT_URL(defaulthttp://127.0.0.1:6333). - Embedding service (fastembed FastAPI) at
VECTOR_EMBED_URL(defaulthttp://127.0.0.1:8500) exposingPOST /embed {texts, is_query}.
Install (local package)
- Add to root
composer.jsonautoload:"Rbk\\VectorSearch\\": "packages/Rbk/VectorSearch/src"thencomposer dump-autoload. - Register
Rbk\VectorSearch\Providers\VectorSearchServiceProvider::classinbootstrap/providers.php. - Add env:
VECTOR_SEARCH_ENABLED=true VECTOR_QDRANT_URL=http://127.0.0.1:6333 VECTOR_EMBED_URL=http://127.0.0.1:8500 VECTOR_COLLECTION=products VECTOR_DIM=384 VECTOR_LIMIT=80 - Create the Qdrant collection (size 384, Cosine), then build the index:
php artisan vector-search:index
Set VECTOR_SEARCH_ENABLED=false to cleanly revert to Bagisto's native search/related.
License
MIT
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-07-08