定制 phpsrprogrammer/bagisto-vector-search 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

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 autosuggestGET /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}/related and /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 (default http://127.0.0.1:6333).
  • Embedding service (fastembed FastAPI) at VECTOR_EMBED_URL (default http://127.0.0.1:8500) exposing POST /embed {texts, is_query}.

Install (local package)

  1. Add to root composer.json autoload: "Rbk\\VectorSearch\\": "packages/Rbk/VectorSearch/src" then composer dump-autoload.
  2. Register Rbk\VectorSearch\Providers\VectorSearchServiceProvider::class in bootstrap/providers.php.
  3. 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
    
  4. 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

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-07-08

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固