Skip to content

Commit a8601ff

Browse files
committed
Update readme
1 parent 59b16f4 commit a8601ff

File tree

1 file changed

+26
-15
lines changed

1 file changed

+26
-15
lines changed

README.md

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,17 @@ This package makes it easy to use native PostgreSQL Full Text Search capabilitie
1212
## Contents
1313

1414
- [Installation](#installation)
15-
- [Scout 4.x](#scout-4x)
16-
- [Scout 2.x, 3.x](#scout-2x-3x)
17-
- [Scout 1.x](#scout-1x)
18-
- [Laravel](#laravel)
19-
- [Lumen](#lumen)
15+
- [Scout 4.x](#scout-4x)
16+
- [Scout 2.x, 3.x](#scout-2x-3x)
17+
- [Scout 1.x](#scout-1x)
18+
- [Laravel](#laravel)
19+
- [Lumen](#lumen)
2020
- [Configuration](#configuration)
21-
- [Configuring the Engine](#configuring-the-engine)
22-
- [Configuring PostgreSQL](#configuring-postgresql)
23-
- [Prepare the Schema](#prepare-the-schema)
24-
- [Configuring Searchable Data](#configuring-searchable-data)
25-
- [Configuring the Model](#configuring-the-model)
21+
- [Configuring the Engine](#configuring-the-engine)
22+
- [Configuring PostgreSQL](#configuring-postgresql)
23+
- [Prepare the Schema](#prepare-the-schema)
24+
- [Configuring Searchable Data](#configuring-searchable-data)
25+
- [Configuring the Model](#configuring-the-model)
2626
- [Usage](#usage)
2727
- [Testing](#testing)
2828
- [Security](#security)
@@ -36,22 +36,26 @@ This package makes it easy to use native PostgreSQL Full Text Search capabilitie
3636
You can install the package via composer:
3737

3838
### Scout 4.x (Laravel 5.4+)
39+
3940
``` bash
4041
composer require pmatseykanets/laravel-scout-postgres
4142
```
4243

4344
### Scout 2.x, 3.x
45+
4446
``` bash
4547
composer require pmatseykanets/laravel-scout-postgres:1.0.0
4648
```
4749

4850
### Scout 1.x
51+
4952
``` bash
5053
composer require pmatseykanets/laravel-scout-postgres:0.2.1
5154
```
5255

5356

5457
### Laravel
58+
5559
If you're using Laravel < 5.5 or if you have package auto-discovery turned off you have to manually register the service provider:
5660

5761
```php
@@ -63,6 +67,7 @@ If you're using Laravel < 5.5 or if you have package auto-discovery turned off y
6367
```
6468

6569
### Lumen
70+
6671
Scout service provider uses `config_path` helper that is not included in the Lumen.
6772
To fix this include the following snippet either directly in `bootstrap.app` or in your autoloaded helpers file i.e. `app/helpers.php`.
6873

@@ -82,6 +87,7 @@ if (! function_exists('config_path')) {
8287
```
8388

8489
Create the `scout.php` config file in `app/config` folder with the following contents
90+
8591
```php
8692
<?php
8793

@@ -124,6 +130,10 @@ Specify the database connection that should be used to access indexed documents
124130
// You can explicitly specify what PostgreSQL text search config to use by scout.
125131
// Use \dF in psql to see all available configurations in your database.
126132
'config' => 'english',
133+
// You may set the default querying method
134+
// Possible values: plainquery, phrasequery, tsquery
135+
// plainquery is used if this option is omitted.
136+
'search_using' => 'tsquery'
127137
],
128138
...
129139
```
@@ -154,13 +164,13 @@ class CreatePostsTable extends Migration
154164
$table->integer('user_id');
155165
$table->timestamps();
156166
});
157-
167+
158168
DB::statement('ALTER TABLE posts ADD searchable tsvector NULL');
159169
DB::statement('CREATE INDEX posts_searchable_index ON posts USING GIN (searchable)');
160170
// Or alternatively
161171
// DB::statement('CREATE INDEX posts_searchable_index ON posts USING GIST (searchable)');
162172
}
163-
173+
164174
public function down()
165175
{
166176
Schema::drop('posts');
@@ -193,7 +203,7 @@ class Post extends Model
193203
{
194204
use Searchable;
195205

196-
...
206+
// ...
197207
public function searchableOptions()
198208
{
199209
return [
@@ -244,7 +254,9 @@ public function searchableAdditionalArray()
244254
];
245255
}
246256
```
257+
247258
You may want to make your searchable column hidden so it's not standing in your way
259+
248260
```php
249261
protected $hidden = [
250262
'searchable',
@@ -255,11 +267,10 @@ protected $hidden = [
255267

256268
Please see the [official documentation](http://laravel.com/docs/master/scout) on how to use Laravel Scout.
257269

258-
259270
## Testing
260271

261272
``` bash
262-
$ composer test
273+
composer test
263274
```
264275

265276
## Security

0 commit comments

Comments
 (0)