nayastudio / laravel-scout-solr
Solr 驱动程序,用于 Laravel Scout,基于 Jeroen Herczege 的 solr 驱动程序。
dev-master / 1.0.x-dev
2023-11-29 14:28 UTC
Requires
- php: ^8.0
- laravel/scout: ^10.0
- solarium/solarium: ^6.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.40
- phpunit/phpunit: ^9.3
- symfony/finder: 6.0.19
This package is auto-updated.
Last update: 2024-09-29 21:54:15 UTC
README
文档
您可以在这里阅读文档。
问题、疑问或评论?
如果您有任何问题、疑问或评论,请随时提交一个问题,我会尽快回复您。
先决条件
安装 Laravel Scout。
安装
通过 Composer 安装
$ composer require jeroenherczeg/laravel-scout-solr
设置 SCOUT_DRIVER 为 solr
// .env
...
SCOUT_DRIVER=solr
您必须在 app.php 配置中添加 Scout 服务提供者和 Solr 引擎服务提供者
// config/app.php
'providers' => [
...
/*
* Package Service Providers...
*/
Laravel\Scout\ScoutServiceProvider::class,
ScoutEngines\Solr\SolrProvider::class,
],
将 Solr 配置添加到 scout 配置文件中
// config/scout.php ... /* |-------------------------------------------------------------------------- | Solr Configuration |-------------------------------------------------------------------------- | | Here you may configure your Solr settings. Solr is the popular, blazing | -fast, open source enterprise search platform built on Apache Lucene. | If necessary, you can override the configuration in your .env file. | */ 'solr' => [ 'host' => env('SOLR_HOST', '127.0.0.1'), 'port' => env('SOLR_PORT', '8983'), 'path' => env('SOLR_PATH', '/solr/'), 'core' => env('SOLR_CORE', 'scout'), ],
用法
现在您可以根据官方文档中的描述使用 Laravel Scout。
在 Laravel Homestead 中使用 Solr
您可以在 Homestead 虚拟机中安装 Solr。
在 Homestead.yaml 中添加端口转发
// ~/Homestead/Homestead.yaml
...
ports:
- send: 18983
to: 8983
...
在 Homestead 后置脚本中添加以下安装步骤。
// ~/Homestead/after.sh
#!/bin/sh
# If you would like to do some extra provisioning you may
# add any commands you wish to this file and they will
# be run after the Homestead machine is provisioned.
#
# If you have user-specific configurations you would like
# to apply, you may also create user-customizations.sh,
# which will be run after this script.
# Install Java Runtime Enviroment
sudo apt-get update
sudo apt-get install default-jre -y
# Install Solr 7.5
wget http://www-eu.apache.org/dist/lucene/solr/7.5.0/solr-7.5.0.tgz
tar zxf solr-7.5.0.tgz
cd solr-7.5.0
bin/solr create -c scout
bin/solr start
您需要重新创建虚拟机。
vagrant destroy && vagrant up
虚拟机安装并运行后,您可以通过 http://127.0.0.1:18983/solr/#/ 访问 Solr 管理员。
变更日志
请参阅 CHANGELOG 以了解最近有哪些更改。
测试
$ composer test
贡献
请参阅CONTRIBUTING 和 CODE_OF_CONDUCT 以获取详细信息。
安全
如果您发现任何安全相关的问题,请通过电子邮件 jeroen@herczeg.be 联系,而不是使用问题跟踪器。
鸣谢
许可证
MIT 许可证 (MIT)。请参阅 许可证文件 以获取更多信息。