2017 © Pedro Peláez
 

library laravel-scout-elasticsearch

ElasticSearch Driver For Laravel Scout

image

rystlee/laravel-scout-elasticsearch

ElasticSearch Driver For Laravel Scout

  • Thursday, April 5, 2018
  • by Macken
  • Repository
  • 0 Watchers
  • 1 Stars
  • 8 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Laravel Scout Elasticsearch Driver

This package is the Elasticsearch driver for Laravel Scout., (*1)

Installation

``` bash composer require rystlee/laravel-scout-elasticsearch, (*2)


### Setting up Elasticsearch configuration You must have a Elasticsearch server up and running with the index you want to use created If you need help with this please refer to the [Elasticsearch documentation](https://www.elastic.co/guide/en/elasticsearch/reference/current/index.html) After you've published the Laravel Scout package configuration: ```php // config/scout.php // Set your driver to elasticsearch 'driver' => env('SCOUT_DRIVER', 'elasticsearch'), ... 'elasticsearch' => [ 'index' => env('ELASTICSEARCH_INDEX', 'laravel'), 'hosts' => [ env('ELASTICSEARCH_HOST', 'http://localhost'), ], ], ...

Highlight Usage

  1. Use RystLee\LaravelScoutElastic\Traits\EsSearchable in the model that needs highlight search results. Then the collection results will contains highlight attribute which has highlight hits relevant to the scout setting toSearchableArray.
  2. Foreach the highlight's results in your view like the following example: @if(isset($post->highlight['body'])) @foreach($post->highlight['body'] as $item) ......{!! $item !!}...... @endforeach @else {{ mb_substr($post->content, 0, 150) }}...... @endif

Usage

Now you can use Laravel Scout as described in the [official documentation](https://laravel.com/docs/5.3/scout, (*3)

License

The MIT License (MIT)., (*4)

The Versions

05/04 2018

dev-master

9999999-dev

ElasticSearch Driver For Laravel Scout

  Sources   Download

The Requires

 

by Avatar Macken

30/11 2017

1.0.0

1.0.0.0

ElasticSearch Driver For Laravel Scout

  Sources   Download

The Requires

 

by Avatar Macken