定制 algolia/search-bundle 二次开发

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

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

algolia/search-bundle

Composer 安装命令:

composer require algolia/search-bundle

包简介

Algolia Search integration for Symfony

README 文档

README

Algolia for Symfony

The perfect starting point to integrate Algolia within your Symfony project

CI Total Downloads Latest Version License

DocumentationPHPLaravelCommunity ForumStack OverflowReport a bugFAQSupport

✨ Features

  • Simple: You can get started with only 5 lines of YAML
  • Robust: Built on top of our PHP Client v4, with waitable responses out of the box
  • Flexible: All methods take optional $requestOptions to let you handle your data as you wish
  • Dev-friendly: Auto-completion and type-hinting thanks to an exhaustive documentation

Algolia SearchBundle requires PHP >= 8.2 and supports Symfony 7 and 8.

💡 Getting Started

First, install Algolia Search Bundle Integration via the composer package manager:

composer require algolia/search-bundle

You will also need to provide the Algolia App ID and Admin API key. By default, they are loaded from environment variables ALGOLIA_APP_ID and ALGOLIA_API_KEY.

If you use .env config file, you can set them there.

ALGOLIA_APP_ID=XXXXXXXXXX
ALGOLIA_API_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

If you don't use environment variables, you can set them in your parameters.yml.

parameters:
    env(ALGOLIA_APP_ID): XXXXXXXXXX
    env(ALGOLIA_API_KEY): xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Indexing data

First, we need to define which entities should be indexed in Algolia. Each entry under the indices config key must contain at least the 2 following attributes:

  • name is the canonical name of the index in Algolia
  • class is the full name of the entity to index

Example:

algolia_search:
  indices:
    - name: posts
      class: App\Entity\Post

Via CLI

Once your indices config is ready, you can use the built-in console command to batch import all existing data.

# Import all indices
php bin/console search:import

# Choose what indices to reindex by passing the index name
php bin/console search:import --indices=posts,comments

Before re-indexing everything, you may want to clear the index first, see how to remove data.

Simple Search

In this example we'll search for posts. The search method will query Algolia to get matching results and then will create a doctrine collection. The data are pulled from the database (that's why you need to pass the Doctrine Manager).

$posts = $this->searchService->search($entityManager, Post::class, 'query');

For full documentation, visit the Algolia Symfony Search Bundle.

Troubleshooting

Encountering an issue? Before reaching out to support, we recommend heading to our FAQ where you will find answers for the most common issues and gotchas with the bundle.

Use the Dockerfile

If you want to contribute to this project without installing all its dependencies, you can use our Docker image. Please check our dedicated guide to learn more.

📄 License

Algolia Symfony Search Bundle is an open-sourced software licensed under the MIT license.

algolia/search-bundle 适用场景与选型建议

algolia/search-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.58M 次下载、GitHub Stars 达 192, 最近一次更新时间为 2017 年 11 月 30 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 algolia/search-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 algolia/search-bundle 我们能提供哪些服务?
定制开发 / 二次开发

基于 algolia/search-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 1.58M
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 193
  • 点击次数: 16
  • 依赖项目数: 2
  • 推荐数: 0

GitHub 信息

  • Stars: 192
  • Watchers: 77
  • Forks: 73
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-11-30