Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
ahuarte47 opened this issue Jan 27, 2023 · 1 comment

Comments

@ahuarte47
Copy link
Contributor

ahuarte47 commented Jan 27, 2023

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

@ahuarte47
Copy link
Contributor Author

I close this issue, related fix was merged!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant