Skip to content
Merged
Changes from 3 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
22 changes: 22 additions & 0 deletions java/working-with-cql/query-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -610,6 +610,28 @@ Select.from("bookshop.Books")
.search(term -> term.has("Allen").or(term.has("Heights")));
```

#### Search in sub-elements of Map <Beta />

You can also search for values of sub-elements of a [cds.Map](cds-data.md#cds-map) element by adding a path to the sub-element to the search scope:

```cds
entity Book : cuid {
category : String;
details : Map;
}
```

```Java
Select.from(BOOK)
.search("CAP Java", List.of("details.summary"))
.where(p -> p.category().eq("Software development"));
```

::: warning
Searching by content of a map element can be expensive on large datasets. Use additional filters on non-map elements to reduce the dataset.

Including the entire map element in the search scope triggers a full-text search on its JSON representation, matching both sub-element names and values. This behavior may yield unexpected results.
:::

#### Using `where` Clause {#where-clause}

Expand Down
Loading