Skip to content

Commit d4e4348

Browse files
committed
trashed text search
1 parent b5e9097 commit d4e4348

File tree

1 file changed

+33
-1
lines changed

1 file changed

+33
-1
lines changed

content/2.endpoints/2.search.md

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -573,4 +573,36 @@ When using full text search, some restrictions happens to the query:
573573
| `filters.type` | Not allowed |
574574
| `filters.nested` | Not allowed |
575575
| **Sorts** | |
576-
| `sorts.field` | take scout fields instead of fields in resource detail |
576+
| `sorts.field` | take scout fields instead of fields in resource detail |
577+
578+
579+
#### Text search with trash
580+
581+
Because the Laravel Scout Builder is not built the same as the Eloquent one, `withTrashed` instruction is not a scope
582+
anymore and work differently:
583+
584+
```json
585+
// (POST) api/posts/search
586+
{
587+
"search": {
588+
"text": {
589+
"value": "my text search",
590+
"trashed": "with"
591+
}
592+
}
593+
}
594+
```
595+
596+
or for `onlyTrashed`:
597+
598+
```json
599+
// (POST) api/posts/search
600+
{
601+
"search": {
602+
"text": {
603+
"value": "my text search",
604+
"trashed": "only"
605+
}
606+
}
607+
}
608+
```

0 commit comments

Comments
 (0)