Skip to content

Bug: Filter clause converts all numbers to integer, search returns wrong results #135

Closed
@ahuarte47

Description

@ahuarte47

Describe the bug
Searching items filtering by properties with floats returns wrong results. Clause converts input query to ES filter using this Union. Because int is defined before float, all numeric values are converted to integer.

To Reproduce
Steps to reproduce the behavior:

  1. Start & ingest S2L2A sample data
  2. Run filter:
{
    "collections": ["test-collection"],
    "limit": 2,
    "fields": {
        "include": [
            "properties.eo:cloud_cover"
        ]
    },
    "filter-lang": "cql2-json",
    "filter": {
        "op": "and",
        "args": [
            {
                "op": ">=",
                "args": [{"property": "properties.eo:cloud_cover"}, 0.02]
            },
            {
                "op": "<=",
                "args": [{"property": "properties.eo:cloud_cover"}, 0.04]
            }
        ]
    }
}
  1. See outputs, items have properties.eo:cloud_cover as 0, because the filter is sent with 0es. The collection has one item with 0.03 (id: S2B_1CCV_20220106_0_L2A), this should be the right result.

Expected behavior
Number should not be cast to int.

Screenshots
Changing order, all numbers are converted to float
image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions