Skip to content

Case-insensitive search in POST /v2/op/query requests for field comparisons #4636

@agomezp7

Description

@agomezp7

Bug description
I'm experiencing a challenge with case sensitivity when making a POST request to /v2/op/query on Fiware Orion. Specifically, I would like to perform a query that is case-insensitive on a specific attribute (e.g., description) without having to use the GET method, as I need the POST request for my use case.

In the current implementation, comparisons using expression.q in POST /v2/op/query are case-sensitive, which means that querying for description==Test or description~=Test will not match an entity with description set to test. However, if I use the GET method with description~=test (regular expression search), the query is case-insensitive and returns the expected results.

How to reproduce it
Steps to reproduce the behavior (as an example)

  1. Current POST Query (Not Working as Case-Insensitive)

    curl --location 'http://localhost:1026/v2/op/query' \
      --header 'Content-Type: application/json' \
      --header 'fiware-service: XXX' \
      --header 'fiware-servicepath: XXX' \
      --data '{
          "entities": [{
                  "idPattern": ".*",
                  "type": "entity"
              }
          ],
          "expression": {
              "q": "description~=Test"
          }
      }'

This POST query does not return any results if the description field in the stored entity is lowercase (test1907) or in a different case.

  1. Alternative GET Query (Works with Case-Insensitive Search)

    curl --location 'http://localhost:1026/v2/entities?id=.*&type=entity&description~=Test' \
    --header 'Content-Type: application/json' \
    --header 'fiware-service: XXX' \
    --header 'fiware-servicepath: XXX'

The GET query above returns the correct results by using description~=Test, which is case-insensitive

Feature request
Could you add support for case-insensitive comparisons in POST /v2/op/query? It would be extremely useful for scenarios where entities need to be queried without regard to case sensitivity on specific fields, especially for large datasets or complex queries that benefit from POST requests.

Thank you for your consideration!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions