Skip to Content
Author's profile photo Mithun Sandeep Korlepara

Enabling Search in SAP HANA using CDS

There are 2 ways to enable the Search features in SAP HANA:

1)     Create Attribute Views in HANA and Consume them on HANA Search UI Toolkit using the SInA API.

For more info please visit this blog Create your own application site using SAP HANA UI Toolkit

2)      Starting with HANA SPS9 we can also create CDS models with Search features enabled by using some annotations and consume them on the

search UI (currently SHINE Application) using OData services.



In this blog we will discuss about how to enable the search features using the CDS models.


–     Defining tables and views using CDS annotations

–     Full-Text searching in OData

–     Consume the CDS views in the Search UI

Step 1:  Defining Tables and Views using CDS annotations:

We create tables and views using .hdbdd files in an XS Project.

The XS Project should also contains the other files which are mandatory .xsaccess, .xsapp and an .xsodata file.

For more info regarding the CDS is available in:

Currently the below Search Annotations can be used to create CDS tables:

@SearchIndex.text – Enable text search on an element of a CDS entity

@Search.textAnalysis – Enables the Text Analysis on the columns

@Search.fuzzinessThreshold – Enable fuzzy search for the given element

These Search Annotations can be used to create CDS views:

@Search.defaultSearchElement – Element is used for freestyle search

@Search.fuzzinessThreshold – Enable fuzzy search for the given column

@Search.ranking – Define the ranking weight for the column

@EnterpriseSearch.usageMode – Define column as auto facet column

@Search.highlighted – Element is used for highlighting the search results

@Search.snippets – Element is used for Snippets functionality in the search results

This is a sample CDS table. For more info please go thru the CDS Documentation.


Sample CDS view –


Once we have all the files in place we can activate the project which should create the tables and the views which we have defined in the .hdbdd file.

These CDS views which has the  Search features enabled can be consumed in the applications.

Currently we have an App in SHINE “Full-Text Search with SAPUI5, ODATA and CDS” which consumes the CDS view.

For more info on SHINE please refer the documentation:

This is how the UI looks like. You can see the data from a CDS view  which is created by joining 2 CDS tables with Search Annotations.

The user is provided with a Search field to find products based on the product text. He or she can also refine the search by selecting the facets that are provided in the Facets column.


In the same way the users can also create their own Search UI’s using SAPUI5 and OData functionalities for Searching / Filtering the data.

Assigned Tags

      Be the first to leave a comment
      You must be Logged on to comment or reply to a post.