cancel
Showing results for 
Search instead for 
Did you mean: 

Fuzzy Search not working in CDS view

0 Kudos

Hi,

   I have created an entity in HCP and a CDS view with a select on the same table. I have enabled fuzzy search with a tolerance of 0.9 (on both the fields) however my query returns all the values on any search string. Please let me know where I am mixing things up. Any help is highly appreciated.

Entity Definition

namespace XXXX.YYY.ZZZ.ARKA;

@Schema: 'ABCD'

context ar3 {

    

  

    @Catalog.tableType: #COLUMN

  

    entity Products{

        key matnr           : String(18);        // MARA - char 18

           @SearchIndex.text.enabled   : true

           @SearchIndex.fuzzy.enabled  : true

            maktx           : String(40);       // MAKT - char 40 - Description

            @SearchIndex.text.enabled   : true

            @SearchIndex.fuzzy.enabled  : true    

};

CDS Definition

   @Search.searchable: true

    define view Fuzzy as select from Products as Products {  

        @EnterpriseSearch.key : true

        @Search.ranking: #HIGH 

        @Search.defaultSearchElement: true

        @Search.fuzzinessThreshold : 0.9 

        Products.matnr,

        @Search.ranking: #HIGH 

        @Search.defaultSearchElement: true

        @Search.fuzzinessThreshold : 0.9 

        Products.maktx };

};

URL

https://myserver.hana.ondemand.com/xxxx/yyyy/zzz/ARKA/Fuzzy.xsodata/FuzzySet?$search=%27ARKA%27

Accepted Solutions (1)

Accepted Solutions (1)

JoergM
Advisor
Advisor
0 Kudos

Hi Arkajeet,

The parameter name is 'search', not '$search'.

The OData service ignores the unknown parameter name '$search', so you do not get back an error.

Regards,

Joerg

0 Kudos

Hi Joerg,

             You saved my day. Thanks a ton!!!

Arka

Answers (0)