Skip to content

Commit 448f46a

Browse files
committed
Update readme.
1 parent a1ccd05 commit 448f46a

File tree

1 file changed

+52
-5
lines changed

1 file changed

+52
-5
lines changed

README.md

Lines changed: 52 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,18 @@ This package makes it easy to use native PostgreSQL Full Text Search capabilitie
3131

3232
You can install the package via composer:
3333

34-
**For scout 1.x**
34+
### Scout 1.x
3535
``` bash
3636
composer require pmatseykanets/laravel-scout-postgres:0.2.1
3737
```
3838

39-
**For scout 2.x**
39+
### Scout 2.x
4040
``` bash
4141
composer require pmatseykanets/laravel-scout-postgres
4242
```
4343

44-
You must install the service provider:
44+
### Laravel
45+
Register the service provider:
4546

4647
```php
4748
// config/app.php
@@ -51,6 +52,54 @@ You must install the service provider:
5152
],
5253
```
5354

55+
### Lumen
56+
Scout service provider uses `config_path` helper that is not included in the Lumen.
57+
To fix this include the following snippet either directly in `bootstrap.app` or in your autoloaded helpers file i.e. `app/helpers.php`.
58+
59+
```php
60+
if (! function_exists('config_path')) {
61+
/**
62+
* Get the configuration path.
63+
*
64+
* @param string $path
65+
* @return string
66+
*/
67+
function config_path($path = '')
68+
{
69+
return app()->basePath() . '/config'.($path ? DIRECTORY_SEPARATOR.$path : $path);
70+
}
71+
}
72+
```
73+
74+
Create the `scout.php` config file in `app/config` folder with the following contents
75+
```php
76+
<?php
77+
78+
return [
79+
'driver' => env('SCOUT_DRIVER', 'pgsql'),
80+
'prefix' => env('SCOUT_PREFIX', ''),
81+
'queue' => false,
82+
'pgsql' => [
83+
'connection' => 'pgsql',
84+
'maintain_index' => true,
85+
'config' => 'english',
86+
],
87+
];
88+
```
89+
90+
Register service providers:
91+
92+
```php
93+
// bootstrap/app.php
94+
$app->register(Laravel\Scout\ScoutServiceProvider::class);
95+
$app->configure('scout');
96+
$app->register(ScoutEngines\Postgres\PostgresEngineServiceProvider::class);
97+
```
98+
99+
## Configuration
100+
101+
### Configuring the Engine
102+
54103
Specify the database connection that should be used to access indexed documents in the Laravel Scout configuration file `config/scout.php`:
55104

56105
```php
@@ -69,8 +118,6 @@ Specify the database connection that should be used to access indexed documents
69118
...
70119
```
71120

72-
## Configuration
73-
74121
### Configuring PostgreSQL
75122

76123
Make sure that an appropriate [default text search configuration](https://www.postgresql.org/docs/9.5/static/runtime-config-client.html#GUC-DEFAULT-TEXT-SEARCH-CONFIG) is set globbaly (in `postgresql.conf`), for a particular database (`ALTER DATABASE ... SET default_text_search_config TO ...`) or alternatively set `default_text_search_config` in each session.

0 commit comments

Comments
 (0)