diff --git a/content/2.endpoints/2.search.md b/content/2.endpoints/2.search.md index 7e54202..30f13a3 100644 --- a/content/2.endpoints/2.search.md +++ b/content/2.endpoints/2.search.md @@ -562,15 +562,36 @@ If you want to specify a full text search you'll need to use the text argument. When using full text search, some restrictions happens to the query: -| **Key** | **Changes** | -|---------------------|--------------------------------------------------------| -| **Scopes** | | -| `scopes.name` | Not allowed | -| `scopes.parameters` | Not allowed | -| **Filters** | | -| `filters.field` | take scout fields instead of fields in resource detail | -| `filters.operator` | `=`/`in`/`not in` | -| `filters.type` | Not allowed | -| `filters.nested` | Not allowed | -| **Sorts** | | -| `sorts.field` | take scout fields instead of fields in resource detail | +| **Key** | **Changes** | +|---------------------|-----------------------------------------------------------------| +| **Scopes** | | +| `scopes.name` | Not allowed | +| `scopes.parameters` | Not allowed | +| **Filters** | | +| `filters.field` | take scout fields instead of fields in resource detail | +| `filters.operator` | `=`/`in`/`not in` | +| `filters.type` | Not allowed | +| `filters.nested` | Not allowed | +| **Sorts** | | +| `sorts.field` | uses Scout fields instead of fields defined in resource details | + +#### Text search with trashed models + +Because the Laravel Scout Builder differs from Eloquent, `withTrashed` is not a scope when performing text search. +Instead, control trashed handling via the `text.trashed` option: + +- "with" → include both non-trashed and trashed records +- "only" → include only trashed records +- omitted → exclude trashed records (default) + +```json +// (POST) api/posts/search +{ + "search": { + "text": { + "value": "my text search", + "trashed": "with" + } + } +} +```