Skip to content

Commit

Permalink
Metadata indexing / parse process steps and measure dates to check th…
Browse files Browse the repository at this point in the history
…at are valid.

If the dates are not valid causes an error in the index, failing the search when the metadata is returned
  • Loading branch information
josegar74 committed Jan 14, 2025
1 parent 67e581e commit 6a85629
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1180,10 +1180,13 @@
<xsl:variable name="processSteps"
select="mrl:processStep/*[mrl:description/gco:CharacterString != '']"/>
<xsl:for-each select="$processSteps">
<xsl:variable name="stepDateTimeZulu"
select="date-util:convertToISOZuluDateTime(normalize-space(mrl:stepDateTime))"/>

<processSteps type="object">{
"descriptionObject": <xsl:value-of select="gn-fn-index:add-multilingual-field(
'description', mrl:description, $allLanguages, true())"/>
<xsl:if test="normalize-space(mrl:stepDateTime) != ''">
<xsl:if test="$stepDateTimeZulu != ''">
,"date": "<xsl:value-of select="mrl:stepDateTime//gml:timePosition/text()"/>"
</xsl:if>
<xsl:if test="normalize-space(mrl:source) != ''">
Expand Down Expand Up @@ -1247,16 +1250,16 @@
select="mdq:valueUnit//gml:identifier"/>
<xsl:variable name="description"
select="(../../mdq:measure/*/mdq:measureDescription/gco:CharacterString)[1]"/>

<xsl:variable name="measureDate"
select="mdq:dateTime/gco:DateTime"/>

select="normalize-space(mdq:dateTime/gco:DateTime)"/>
<xsl:variable name="measureDateZulu"
select="date-util:convertToISOZuluDateTime($measureDate)"/>
<measure type="object">{
"name": "<xsl:value-of select="util:escapeForJson($name)"/>",
<xsl:if test="$description != ''">
"description": "<xsl:value-of select="util:escapeForJson($description)"/>",
</xsl:if>
<xsl:if test="$measureDate != ''">
<xsl:if test="$measureDateZulu != ''">
"date": "<xsl:value-of select="util:escapeForJson($measureDate)"/>",
</xsl:if>
<!-- First value only. -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1033,12 +1033,14 @@
select="(../../gmd:measureDescription/gco:CharacterString)[1]"/>
<xsl:variable name="measureDate"
select="(../../gmd:dateTime/gco:DateTime)[1]"/>
<xsl:variable name="measureDateZulu"
select="date-util:convertToISOZuluDateTime($measureDate)"/>
<measure type="object">{
"name": "<xsl:value-of select="util:escapeForJson($name)"/>",
<xsl:if test="$description != ''">
"description": "<xsl:value-of select="util:escapeForJson($description)"/>",
</xsl:if>
<xsl:if test="$measureDate != ''">
<xsl:if test="$measureDateZulu != ''">
"date": "<xsl:value-of select="util:escapeForJson($measureDate)"/>",
</xsl:if>
<!-- First value only. -->
Expand All @@ -1060,10 +1062,13 @@
<xsl:variable name="processSteps"
select="gmd:lineage/*/gmd:processStep/*[gmd:description/gco:CharacterString != '']"/>
<xsl:for-each select="$processSteps">
<xsl:variable name="stepDateTimeZulu"
select="date-util:convertToISOZuluDateTime(normalize-space(gmd:dateTime))"/>

<processSteps type="object">{
"descriptionObject": <xsl:value-of select="gn-fn-index:add-multilingual-field(
'description', gmd:description, $allLanguages, true())"/>
<xsl:if test="normalize-space(gmd:dateTime) != ''">
<xsl:if test="$stepDateTimeZulu != ''">
,"date": "<xsl:value-of select="gmd:dateTime/gco:*/text()"/>"
</xsl:if>
<xsl:if test="normalize-space(gmd:source) != ''">
Expand Down

0 comments on commit 6a85629

Please sign in to comment.