Skip to content

Commit 2f3423a

Browse files
committed
Update 2.search.md
1 parent d4e4348 commit 2f3423a

File tree

1 file changed

+21
-32
lines changed

1 file changed

+21
-32
lines changed

content/2.endpoints/2.search.md

Lines changed: 21 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -562,24 +562,27 @@ 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 |
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:
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)
583586

584587
```json
585588
// (POST) api/posts/search
@@ -592,17 +595,3 @@ anymore and work differently:
592595
}
593596
}
594597
```
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)