jeroenherczeg / laravel-scout-solr
Laravel Scout 的 Solr 驱动程序
v0.1.3
2020-10-27 18:47 UTC
Requires
- php: ^7.3
- laravel/scout: ^8.0
- solarium/solarium: ^4.2
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.16
- phpunit/phpunit: ^9.3
This package is auto-updated.
Last update: 2024-08-29 05:22:19 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 的 after.sh 脚本中。
// ~/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 管理员。
变更日志
请参阅变更日志了解最近的变化。
测试
$ composer test
贡献
安全
如果您发现任何与安全相关的问题,请通过电子邮件 jeroen@herczeg.be 而不是使用问题跟踪器。
致谢
许可
MIT 许可证 (MIT)。请参阅许可文件以获取更多信息。