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 e6882b3 commit f52c2cd
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1110,10 +1110,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)"/>
<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 @@ -1177,17 +1180,17 @@
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 != ''">
"date": "<xsl:value-of select="gn-fn-index:json-escape($measureDate)"/>",
<xsl:if test="$measureDateZulu != ''">
"date": "<xsl:value-of select="util:escapeForJson($measureDate)"/>",
</xsl:if>
<!-- First value only. -->
"value": "<xsl:value-of select="util:escapeForJson($value[1])"/>",
Expand Down
13 changes: 9 additions & 4 deletions schemas/iso19139/src/main/plugin/iso19139/index-fields/index.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -987,14 +987,16 @@
<xsl:variable name="description"
select="(../../gmd:measureDescription/gco:CharacterString)[1]"/>
<xsl:variable name="measureDate"
select="../../gmd:dateTime/gco:DateTime"/>
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 != ''">
"date": "<xsl:value-of select="gn-fn-index:json-escape($measureDate)"/>",
<xsl:if test="$measureDateZulu != ''">
"date": "<xsl:value-of select="util:escapeForJson($measureDate)"/>",
</xsl:if>
<!-- First value only. -->
"value": "<xsl:value-of select="util:escapeForJson($value/gco:Record[1])"/>",
Expand All @@ -1015,10 +1017,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)"/>
<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 f52c2cd

Please sign in to comment.