cancel
Showing results for 
Search instead for 
Did you mean: 

How to use fuzzy search in cds query

sander_star2
Explorer
0 Kudos
1,324

In a UI5 app some filters are set like

new oFilter("lastName", oFilterOperator.Contains, oParams.name),
new oFilter("firstName", oFilterOperator.Contains, oParams.name),
new oFilter("companyName", oFilterOperator.Contains, oParams.name)


In the cds entity fuzzy search is enabled on database level like

@sql.append: 'FUZZY SEARCH INDEX ON' 
firstName : String default ''; 
  
@sql.append: 'FUZZY SEARCH INDEX ON' lastName : String default '';
@sql.append: 'FUZZY SEARCH INDEX ON' companyName : String default '';

This is working on database level in Hana with queries like

SELECT * FROM Dummy where CONTAINS(lastName, 'Companie', FUZZY (0.8))
  

But how should you invoke this on a cds query?
View Entire Topic
Cguttikonda
Explorer
0 Kudos

Hello Sander,

In case of SAP CAPM, the fuzzy search has to be implemented at the service level by altering the req object.

Do not see an option to send the filter parameter for fuzzy search from UI5 and this has been achieved by implementing the custom logic at the service layer.