Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 33 additions & 12 deletions content/2.endpoints/2.search.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
}
```