geonetwork / core-geonetwork

GeoNetwork is a catalog application to manage spatially referenced resources. It provides powerful metadata editing and search functions as well as an interactive web map viewer. It is currently used in numerous Spatial Data Infrastructure initiatives across the world.
http://geonetwork-opensource.org/
GNU General Public License v2.0
430 stars 489 forks source link

ISO19139 / ISO19115.3 / Index resource date fields as defined in the metadata. #8365

Closed josegar74 closed 1 month ago

josegar74 commented 2 months ago

Previously the values were converted to UTC. If the timezone defined in the server is Europe/Madrid and the metadata has a creation date '2023-01-01T00:00:00', the index field creationYearForResource had the value 2022

Test case:

1) Create an ISO19139 and add a creation date 2023-01-01T00:00:00.

creation-date

2) In the UI settings replace the Search application facet creationYearForResource with

  "creationYearForResource": {
    "terms": {
      "field": "creationYearForResource",
      "order": {
        "_key": "desc"
      }
    },
    "meta": {
      "collapsed": true
    }
  },

creation-date-facet

3) Go to the search page:

facet-no-ok

facet-ok


@fxprunayre, instead of extracting the year from the XML content, should we convert the date for these fields, not to UTC, but to the server timezone configured?

With the current change we are not dealing with metadata dates that have a timezone.

Checklist

fxprunayre commented 2 months ago

instead of extracting the year from the XML content, should we convert the date for these fields, not to UTC, but to the server timezone configured?

On the long run, we should probably rely on https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-datehistogram-aggregation.html#datehistogram-aggregation-time-zone, which means index in UTC and convert and format for a timezone