Skip to content

Commit b76575b

Browse files
committed
fix(@cds.search): wrong inclusion logic and sample
this did not reflect what is actually happening. In reality, providing elements to the `@cds.search` annotation, effectively removes all default searchable elements from being searched. To avoid confusion and future tickets, a promiment warning clarifying this behavior is added with this change.
1 parent dce3c76 commit b76575b

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

guides/providing-services.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,15 @@ entity Books { ... }
402402
entity Authors { ... }
403403
```
404404

405-
Searches all elements of the `Books` entity, as well as all searchable elements of the associated `Authors` entity. Which elements of the associated entity are searchable is determined by the `@cds.search` annotation on the associated entity. So, from `Authors`, all elements of type `String` are searched but `biography` is excluded.
405+
When searching the `Books`entity all searchable elements of the associated `Authors` entity are included in the search.
406+
407+
::: warning
408+
The default searchable elements of `Books` are overwritten by the explicitly provided elements in the `@cds.search` annotation.
409+
If you'd want to search e.g. the `Books:title` as well, you'd have have to include the `Books:title` next to `author` explicitly.
410+
:::
411+
412+
Which elements of the associated entity are searchable is determined by the `@cds.search` annotation on the associated entity.
413+
For `Authors`, all elements of type `String` are searched but `biography` is excluded.
406414

407415
##### Extend to Individual Elements in Associated Entities
408416

0 commit comments

Comments
 (0)