Skip to content

Commit c190b3f

Browse files
authored
trashed text search (#84)
1 parent b5e9097 commit c190b3f

File tree

1 file changed

+33
-12
lines changed

1 file changed

+33
-12
lines changed

content/2.endpoints/2.search.md

Lines changed: 33 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -562,15 +562,36 @@ If you want to specify a full text search you'll need to use the text argument.
562562

563563
When using full text search, some restrictions happens to the query:
564564

565-
| **Key** | **Changes** |
566-
|---------------------|--------------------------------------------------------|
567-
| **Scopes** | |
568-
| `scopes.name` | Not allowed |
569-
| `scopes.parameters` | Not allowed |
570-
| **Filters** | |
571-
| `filters.field` | take scout fields instead of fields in resource detail |
572-
| `filters.operator` | `=`/`in`/`not in` |
573-
| `filters.type` | Not allowed |
574-
| `filters.nested` | Not allowed |
575-
| **Sorts** | |
576-
| `sorts.field` | take scout fields instead of fields in resource detail |
565+
| **Key** | **Changes** |
566+
|---------------------|-----------------------------------------------------------------|
567+
| **Scopes** | |
568+
| `scopes.name` | Not allowed |
569+
| `scopes.parameters` | Not allowed |
570+
| **Filters** | |
571+
| `filters.field` | take scout fields instead of fields in resource detail |
572+
| `filters.operator` | `=`/`in`/`not in` |
573+
| `filters.type` | Not allowed |
574+
| `filters.nested` | Not allowed |
575+
| **Sorts** | |
576+
| `sorts.field` | uses Scout fields instead of fields defined in resource details |
577+
578+
#### Text search with trashed models
579+
580+
Because the Laravel Scout Builder differs from Eloquent, `withTrashed` is not a scope when performing text search.
581+
Instead, control trashed handling via the `text.trashed` option:
582+
583+
- "with" → include both non-trashed and trashed records
584+
- "only" → include only trashed records
585+
- omitted → exclude trashed records (default)
586+
587+
```json
588+
// (POST) api/posts/search
589+
{
590+
"search": {
591+
"text": {
592+
"value": "my text search",
593+
"trashed": "with"
594+
}
595+
}
596+
}
597+
```

0 commit comments

Comments
 (0)