项目作者: jeroenherczeg

项目描述 :
Solr Driver for Laravel Scout
高级语言: PHP
项目地址: git://github.com/jeroenherczeg/laravel-scout-solr.git
创建时间: 2018-10-04T15:07:49Z
项目社区:https://github.com/jeroenherczeg/laravel-scout-solr

开源协议:MIT License

下载


Solr Driver for Laravel Scout



Latest Version on Packagist
Software License
Build Status
Coverage Status
Quality Score
Total Downloads
Laravel Scout
Apache Solr
PHP

Documentation

You can read the documentation here.

Problems, questions or comments?

If you have any problems, questions or comments, feel free to submit an issue and I will reply to you as soon as possible.

Prerequisites

Install Laravel Scout.

Install

Install via Composer

  1. $ composer require jeroenherczeg/laravel-scout-solr

Set your SCOUT_DRIVER to solr:

  1. // .env
  2. ...
  3. SCOUT_DRIVER=solr

You must add the Scout service provider and the Solr engine service provider in your app.php config:

  1. // config/app.php
  2. 'providers' => [
  3. ...
  4. /*
  5. * Package Service Providers...
  6. */
  7. Laravel\Scout\ScoutServiceProvider::class,
  8. ScoutEngines\Solr\SolrProvider::class,
  9. ],

Add the Solr configuration to the scout config file:

  1. // config/scout.php
  2. ...
  3. /*
  4. |--------------------------------------------------------------------------
  5. | Solr Configuration
  6. |--------------------------------------------------------------------------
  7. |
  8. | Here you may configure your Solr settings. Solr is the popular, blazing
  9. | -fast, open source enterprise search platform built on Apache Lucene.
  10. | If necessary, you can override the configuration in your .env file.
  11. |
  12. */
  13. 'solr' => [
  14. 'host' => env('SOLR_HOST', '127.0.0.1'),
  15. 'port' => env('SOLR_PORT', '8983'),
  16. 'path' => env('SOLR_PATH', '/solr/'),
  17. 'core' => env('SOLR_CORE', 'scout'),
  18. ],

Usage

Now you can use Laravel Scout as described in the official documentation

Using Solr with Laravel Homestead

You can install Solr within your Homestead virtual machine.

Add the port forwarding to your Homestead.yaml

  1. // ~/Homestead/Homestead.yaml
  2. ...
  3. ports:
  4. - send: 18983
  5. to: 8983
  6. ...

Add the following install steps to your Homestead after.sh script.

  1. // ~/Homestead/after.sh
  2. #!/bin/sh
  3. # If you would like to do some extra provisioning you may
  4. # add any commands you wish to this file and they will
  5. # be run after the Homestead machine is provisioned.
  6. #
  7. # If you have user-specific configurations you would like
  8. # to apply, you may also create user-customizations.sh,
  9. # which will be run after this script.
  10. # Install Java Runtime Enviroment
  11. sudo apt-get update
  12. sudo apt-get install default-jre -y
  13. # Install Solr 7.5
  14. wget http://www-eu.apache.org/dist/lucene/solr/7.5.0/solr-7.5.0.tgz
  15. tar zxf solr-7.5.0.tgz
  16. cd solr-7.5.0
  17. bin/solr create -c scout
  18. bin/solr start

You will need to recreate your the virtual machine.

  1. vagrant destroy && vagrant up

Once the virtual machine is installed and running, you can access Solr admin on http://127.0.0.1:18983/solr/#/ .

Change log

Please see CHANGELOG for more information on what has changed recently.

Testing

  1. $ composer test

Contributing

Please see CONTRIBUTING and CODE_OF_CONDUCT for details.

Security

If you discover any security related issues, please email jeroen@herczeg.be instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.