-
Notifications
You must be signed in to change notification settings - Fork 133
Searchable @Common.Text Annotation #2041
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
3bcaf75
a478fdd
ef2ba29
19a843d
ed25aa1
c4e8f89
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -426,6 +426,26 @@ Searches all elements of type `String` excluding the element `isbn`, which leave | |||||
You can explicitly annotate calculated elements to make them searchable, even though they aren't searchable by default. The virtual elements won't be searchable even if they're explicitly annotated. | ||||||
::: | ||||||
|
||||||
#### The `@Common.Text` Annotation | ||||||
|
||||||
If an entity has an element annotated with the `@Common.Text` annotation, then the property that holds the display text is by default added to the searchable elements. Example: | ||||||
|
||||||
```cds | ||||||
entity Books : cuid { | ||||||
title : String; | ||||||
@Common.Text : author.name | ||||||
author : Association to Author; | ||||||
} | ||||||
etimr marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
entity Author : cuid { | ||||||
name : String; | ||||||
} | ||||||
``` | ||||||
The default searchable elements of `Books` are `title` and `author.name`. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
::: warning | ||||||
Do not use both `@cds.search` and `@Common.Text` annotations on the same entity, unless `@cds.search` is used only to exclude fields. If both are present and `@cds.search` includes fields, the `@Common.Text` annotation will be ignored. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this specific to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If I add |
||||||
::: | ||||||
|
||||||
#### Fuzzy Search on SAP HANA Cloud <Beta /> {#fuzzy-search} | ||||||
|
||||||
> Prerequisite: For CAP Java, you need to run in [`HEX` optimization mode](../java/cqn-services/persistence-services#sql-optimization-mode) on SAP HANA Cloud and enable <Config java keyOnly>cds.sql.hana.search.fuzzy = true</Config> | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MattSchur the subsection
The @Common.Text Annotation
belongs to theSearching Data
section, right after@cds.search
. I think@Common.Text
should be described here only from the search perspective, not as UI annotation.If we need to describe what
@Common.Text
means as UI annotation, we can add it here https://cap.cloud.sap/docs/advanced/odata, where it mentioned several times.Also the exact same text is used in the Java release notes and will be used in the Node release notes as well with the link to this documentation. I think it should be rephrased with the focus on the search.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I didn't notice that this is a subsection of Search