Skip to content

Commit 9c01820

Browse files
committed
Update readme
1 parent 9c92290 commit 9c01820

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,24 @@ protected $hidden = [
265265

266266
## Usage
267267

268+
```php
269+
// plainto_tsquery()
270+
$results = App\Post::search('cat rat')->usingPlainQuery()->get()
271+
272+
// plainto_tsquery()
273+
$results = App\Post::search('cat rat')->usingPhraseQuery()->get()
274+
275+
// to_tsquery()
276+
$results = App\Post::search('fat & (cat | rat)')->usingTsQuery()->get()
277+
278+
// DIY using a callback
279+
use ScoutEngines\Postgres\TsQuery\ToTsQuery;
280+
281+
$results = App\Post::search('fat & (cat | rat)', function ($builder, $config) {
282+
return new ToTsQuery($builder->query, $config);
283+
})->get();
284+
```
285+
268286
Please see the [official documentation](http://laravel.com/docs/master/scout) on how to use Laravel Scout.
269287

270288
## Testing

0 commit comments

Comments
 (0)