52North / sensorweb-server-sta

Other
11 stars 11 forks source link

Filter by phenomenonTime does not work properly on GET Datastreams(id)/Observations #67

Closed stmarseglia closed 4 years ago

stmarseglia commented 4 years ago

The request: localhost:8081/sta/Datastreams(82ee4dcf-9085-49ea-9be2-4719d7ffbd08)/Observations?$select=result,phenomenonTime

returns this data:

{
    "@iot.count": 3,
    "value": [
        {
            "result": "70.4000000000",
            "phenomenonTime": "2012-06-26T09:43:02.000Z"
        },
        {
            "result": "70.4000000000",
            "phenomenonTime": "2012-06-26T09:44:02.000Z"
        },
        {
            "result": "70.4000000000",
            "phenomenonTime": "2012-06-26T09:45:02.000Z"
        }
  ]
}

When I add the query string parameter &$filter=phenomenonTime ge 2012-06-26T09:45:02.000Z, the values are returned as the last response, without filtering.

I've also noticed that if I change the property name to be filtered, no exception is raised, e.g. &$filter=xyz ge 2012-06-26T09:45:02.000Z gets the same response.

I don't know if this is a wrong behaviour or, given that the filter has to be applied to a related collection of entities (Observations of a Datastream) it has to be expressed in another way.

SpeckiJ commented 4 years ago

Thanks for the bug report - I will look into it asap.

To better triage the error it would be helpful to know which Version of the STA you are using exactly. Can you provide that information @stmarseglia ?

stmarseglia commented 4 years ago

Thank you

Yes, I built the image with the dockerfile provided in the https://github.com/52North/sensorweb-server-sta/releases/tag/v2.0.1 commit. I've then used the image with docker compose:

version: '3'
services:
  52-sta:
    image: sensorweb-server-sta:latest
    ports:
      - 8081:8081
      - 1883:1883
      - 8883:8883
    environment:
      LOGGING_LEVEL_ROOT: INFO
      LOGGING_LEVEL_ORG_N52: TRACE
      SPRING_DATASOURCE_URL: jdbc:postgresql://database:5432/sta
      SPING_JPA_PROPERTIES_HIBERNATE_HBM2DDL: update
      MQTT_BROKER_PLAINTCP_ENABLED: "true"
      MQTT_BROKER_WEBSOCKET_ENABLED: "true"
      MQTT_BROKER_PERSISTENCE_ENABLED: "false"
      SERVER_ROOTURL: http://localhost:8081/sta/
      SERVER_SERVLET_CONTEXT_PATH: /sta
      SERVER_FEATURE_UPDATEFOI: "false"
      SERVER_FEATURE_MQTTPUBLISHTOPICS: Observations
      SERVER_FEATURE_VARIABLEENCODINGTYPE: "false"
      SERVER_FEATURE_ISMOBILE: "false"
    depends_on:
    - database

  database:
    image: mdillon/postgis
    restart: on-failure
    ports:
      - 5432:5432
    environment:
      - POSTGRES_DB=sta
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=postgres
      - ALLOW_IP_RANGE=0.0.0.0/0
      - POSTGRES_MULTIPLE_EXTENSIONS=postgis

where sensorweb-server-sta:latest is the image I've built

SpeckiJ commented 4 years ago

This should be solved with https://github.com/52North/sensorweb-server-sta/commit/2fd0f9bab9d1f5af40f9d52180b764b703662ba9 and is included since v2.0.2-SNAPSHOT. A new Docker Image will be available shortly.

Thanks for the report :+1:

stmarseglia commented 4 years ago

works like a charm now, thank you!