algolia/laravel-scout-settings
Composer 安装命令:
composer require algolia/laravel-scout-settings
包简介
Import/Export Algolia settings into your Laravel Scout project
README 文档
README
DEPRECATED: Use of this repository is deprecated. Please use Scout Extended - https://github.com/algolia/scout-extended instead.
Laravel Scout Settings
Import/Export Algolia settings, synonyms and query rules into your Laravel Scout project.
The easiest way to manage your settings is usually to go to your Algolia dashboard because it has a nice UI and you can test the relevancy directly there.
Once you fine tuned your configuration, you may want to add it to your project.
This package adds two Laravel commands to your project:
- one to save your settings, synonyms and query rules into JSON files
- one to push everything back to Algolia
This has 3 major advantages:
- You can version your configuration with your VCS
- You can set up a new environment or restore backups easily
- It lets you customize your settings in JSON format before pushing them
Install
Install this package with composer
composer require algolia/laravel-scout-settings
Laravel 5.5
If you use Laravel 5.5, this package will take advantage of the Package Auto-Discovery feature. Nothing more to do to register the commands.
Laravel 5.4 and prior
If you use an older version of Laravel, you will have to add the Service Provider to
the providers array in config/app.php
Algolia\Settings\ServiceProvider::class,
Usage
You will now get two new commands available in artisan. They both take a model's fully
qualified class name, just like Laravel Scout does to import/flush data.
The following example assume you have an App\Contact class, which uses the Searchable trait.
Note: Scout allows you to customize the index name with the
searchableAs() method. This package
will follow this naming convention.
Backing up settings (Project ⬅️ Algolia)
The following command will export all the settings and synonyms from the App\Contact's
index into the following files:
- Settings:
resources/algolia-settings/index_name.json - Synonyms:
resources/algolia-settings/index_name-synonyms.json - Query Rules:
resources/algolia-settings/index_name-rules
php artisan algolia:settings:backup "App\Contact"
Note that if you want to add the prefix to your file names (which was the default behavior in v1),
you can pass the --prefix option.
php artisan algolia:settings:backup "App\Contact" --prefix
Pushing settings (Project ➡️ Algolia)
The following command will read all the settings, synonyms and query rules from the
files in resources/algolia-settings/ and import them into Algolia's index.
php artisan algolia:settings:push "App\Contact"
You can also pass the --prefix option, just like the backup command.
Customizing directory
By default, settings, rules and synonyms are saved into the resources/algolia-settings.
The directory can be customized by the defining an environment variable named ALGOLIA_SETTINGS_FOLDER.
For example, the following command will save all the index resources into resources/indexmeta.
ALGOLIA_SETTINGS_FOLDER=indexmeta php artisan algolia:settings:backup
Testing
composer test
Need help?
Feel free to open a thread on our Community forum
Contribute
Contributions are welcome!
algolia/laravel-scout-settings 适用场景与选型建议
algolia/laravel-scout-settings 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 397.83k 次下载、GitHub Stars 达 23, 最近一次更新时间为 2017 年 07 月 26 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「search」 「laravel」 「algolia」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 algolia/laravel-scout-settings 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 algolia/laravel-scout-settings 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 algolia/laravel-scout-settings 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
An exhanced replacement Place field type to include additional latitude and longitude
A Laravel package to retrieve data from Google Search Console
A collection macros to extend Laravel Scout with more Algolia capabilities
Indexed Search Autocomplete - Extends the TYPO3 Core Extension Indexed_Search searchform with an autocomplete feature.
Abstraction Layer to index and search entities
Optimus Bard takes the content from a Statamic Bard field and transforms it into a string when updating your search index
统计信息
- 总下载量: 397.83k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 23
- 点击次数: 24
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-07-26