SAP / open-ux-odata

Enable community collaboration to jointly promote and facilitate best in class framework and tooling capabilities when working with OData services.
Apache License 2.0
51 stars 11 forks source link

BUG - $search query param is not case insensitive #730

Closed swayongshen closed 11 months ago

swayongshen commented 1 year ago

Description

Not sure if this is intended or not, but in a CAP server, the $search URL query param results in case-insensitive search, but in the mockserver its case-sensitive. So we have a different behavior when developing locally versus when interacting with the backend.

Steps to Reproduce

Steps to reproduce the behavior:

  1. Send a OData v4 request containing a $search param.

Expected results

Should return results based on case-insensitive matching.

Actual results

Return results with case-sensitive matching.

Screenshots

If applicable, add screenshots to help explain the problem.

Version/Components/Environment

Add any other context about the problem here OS:

Root Cause Analysis

Problem

{describe the problem}

Fix

{describe the fix}

Why was it missed

{Some explanation why this issue might have been missed during normal development/testing cycle}

How can we avoid this

{if we don’t want to see this type of issues anymore what we should do to prevent}

nlunets commented 1 year ago

Not a bug per se because in the end the odata specification is pretty clear that search is kind of up to the implementation :)

Example 107: all products that are blue or green. It is up to the service to decide what makes a product blue or green.
http://host/service/Products?$search=blue OR green

That being said you can override the search behavior by implementing the checkSearchQuery on your mock data file.

The base implementation is just doing a string.includes :)

here is the signature of the method, let me know if this helps checkSearchQuery(mockValue: any, searchQuery: string, odataRequest: ODataRequest): boolean

swayongshen commented 11 months ago

Ok, thank you :+1: