klaasie/scout-solr-engine
Composer 安装命令:
composer require klaasie/scout-solr-engine
包简介
An Apache Solr driver for laravel scout
README 文档
README
This package provides a basic implementation of the Apache Solr search engine within Laravel Scout.
Installation
composer require klaasie/scout-solr-engine
config
This package provides a config file that can be modified using .env variables.
You can initialize your own config file with:
php artisan vendor:publish --provider="Scout\Solr\ScoutSolrServiceProvider"
scout:index
By default, Solr doesn't allow indexes (cores) to be created without providing the proper folders and files on the file system first.
However, if a default config set is set up in the Solr instance this becomes possible through the API.
The scout:index command will only work if the Solr instance is properly configured and the config files has the corresponding name for the config set folder.
For more information, see https://solr.apache.org/guide/8_9/config-sets.html#config-sets
Cores (indexes)
Within the config file a core (index) is not provided. The engine will determine which core to connect to using the searchableAs() method on the model.
Alternatively, if a specific model is on a different Solr instance, another configuration can be provided for this model.
It's important for the configuration key to match the searchableAs() of the model.
Solarium
This package uses solarium/solarium to handle requests to the solr instance. This app is meant to be a simple implementation of the laravel/scout engine. For complex queries to the solr instance I would recommend initializing your own Solarium client and use that package. Visit https://solarium.readthedocs.io/en/stable/ to view the documentation of the solarium package.
For convenience, any unknown methods used on the engine will be forwarded to the solarium client.
$model = new \App\Models\SearchableModel(); /** @var \Scout\Solr\Engines\SolrEngine $engine */ $engine = app(\Laravel\Scout\EngineManager::class)->engine(); $select = $engine->setCore($model)->createSelect(); $select->setQuery('*:*'); $result = $engine->select($select, $engine->getEndpointFromConfig($model->searchableAs())); // getEndpointFromConfig() is only necessary when your model does not use the default solr instance.
Events
The Solr Engine dispatches several events allowing you to hook into specific points in the engine.
| Event | Usage |
|---|---|
| Scout\Solr\Events\BeforeSelect | Contains the Solr Solarium\QueryType\Select\Query\Query object and Scout Builder object. This event allows you to create complex queries using the Solarium package. |
| Scout\Solr\Events\BeforeSelect | Contains the Solr Solarium\QueryType\Select\Result\Result object and Model object. This event allows you to create complex queries using the Solarium package. |
Example
This repository provides an example laravel app showcasing the functionality of this package.
Please refer to the README.md of the example app for information on how to get it started.
klaasie/scout-solr-engine 适用场景与选型建议
klaasie/scout-solr-engine 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 9.35k 次下载、GitHub Stars 达 4, 最近一次更新时间为 2021 年 09 月 11 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「solr」 「search」 「engine」 「driver」 「laravel」 「apache」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 klaasie/scout-solr-engine 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 klaasie/scout-solr-engine 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 klaasie/scout-solr-engine 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A bundle which extend ibexa solr search handler
A Laravel package to retrieve data from Google Search Console
This extension provides integration with solr to output content from TYPO3 in JSON format.
Laminas Module for interaction between a laminas application and a SOLR search engine using Solarium
Indexed Search Autocomplete - Extends the TYPO3 Core Extension Indexed_Search searchform with an autocomplete feature.
A SilverStripe module to optimise the Meta, crawling, indexing, and sharing of your website content (forked from Cyber-Duck/Silverstripe-SEO)
统计信息
- 总下载量: 9.35k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 15
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-09-11