SPW-DIG / metawal-core-geonetwork

Metawal - Catalogue pour l'information géographique de Wallonie
http://metawal.wallonie.be
GNU General Public License v2.0
3 stars 1 forks source link

Erreurs indexation MW test (new) #880

Open marceaulouis opened 1 month ago

marceaulouis commented 1 month ago

On a pas mal de fiches en erreur sur le nouveau MW test, pour des fiches récentes

ex :

7132b6ec-9b4f-4e00-87f8-1f66034171d4

e6c8d704-375a-4e09-a130-f1f1de376e9a

image

Ces fiches sont publiées en prod sans problème

fxprunayre commented 1 month ago

En local, je n'ai pas de pb. @GeryNi tu reproduis ? Il faudrait voir les logs du serveur de test pour en savoir plus.

fxprunayre commented 1 month ago

Vu qu'on a changé de serveur Elastic, peut être des problèmes de limites eg. https://github.com/geonetwork/core-geonetwork/tree/main/es#troubleshoot A vérifier dans les logs.

GeryNi commented 1 month ago

En local dans les logs je rencontre le même problème:

2024-05-28T09:25:16,348``` WARN  [geonetwork.index] - Record #58725 (mode: full) indexed in 78ms
Error on line 1388 of index.xsl:
  XPTY0004: A sequence of more than one item is not allowed as the first argument of
  util:escapeForJson() ("WalOnMap", "WalOnMap") 
2024-05-28T09:25:16,576 ERROR [geonetwork.index] - Indexing stylesheet contains errors: A sequence of more than one item is not allowed as the first argument of util:escapeForJson() ("WalOnMap", "WalOnMap")  
  Marking the metadata as _indexingError=1 in index

Ligne en erreur:

            "applicationProfile":"<xsl:value-of select="util:escapeForJson(cit:applicationProfile/(gco:CharacterString|gcx:Anchor)/text())"/>",
fxprunayre commented 1 month ago

En effet le problème vient de fiche ayant plusieurs applicationProfile dans les liens.


WITH ns AS (
    select ARRAY[ARRAY['xlink', 'http://www.w3.org/1999/xlink'],
               ARRAY['mdb', 'http://standards.iso.org/iso/19115/-3/mdb/2.0'],
               ARRAY['cit', 'http://standards.iso.org/iso/19115/-3/cit/2.0'],
               ARRAY['mri', 'http://standards.iso.org/iso/19115/-3/mri/1.0'],
               ARRAY['mco', 'http://standards.iso.org/iso/19115/-3/mco/1.0'],
               ARRAY['xsi', 'http://www.w3.org/2001/XMLSchema-instance'],
               ARRAY['gco', 'http://standards.iso.org/iso/19115/-3/gco/1.0']] AS n
)

SELECT uuid,
               unnest(xpath('count(//cit:CI_OnlineResource[count(cit:applicationProfile) > 1])',
                            XMLPARSE(DOCUMENT data), n))::text  AS online
FROM metadata, ns
ORDER BY online desc

Il faudrait corriger les fiches car ce n'est pas valide.

marceaulouis commented 1 month ago

C'est bizarre, en prod ça passe la validation

https://metawal.wallonie.be/geonetwork/srv/fre/catalog.search#/metadata/7132b6ec-9b4f-4e00-87f8-1f66034171d4

Je suppose que ce sont les liens WoM ADU (ce n'est pas une blague) image

fxprunayre commented 1 month ago

@GeryNi a des fiches dans sa base locale avec 2 cit:applicationProfile d'où l'erreur


<cit:protocol>
<gco:CharacterString>WWW:LINK</gco:CharacterString>
</cit:protocol>
<cit:applicationProfile>
<gco:CharacterString>WalOnMap</gco:CharacterString>
</cit:applicationProfile>
<cit:applicationProfile>
<gco:CharacterString>WalOnMap</gco:CharacterString>
</cit:applicationProfile>

mais en prod ce n'est pas le cas, en tout cas pour les fiches 7132b6ec-9b4f-4e00-87f8-1f66034171d4 et e6c8d704-375a-4e09-a130-f1f1de376e9a

GeryNi commented 1 month ago

7132b6ec-9b4f-4e00-87f8-1f66034171d4

C'est le cas sur le nouvel environnement TEST: image

Est-ce que l'erreur aurait pu s'introduire au moment du harvesting ?

GeryNi commented 4 weeks ago

Suite à investigation avec Francois, voci les requêtes DB pour trouver et corriger les fiches:

SELECT COUNT(uuid) FROM metadata WHERE regexp_like(data, '<cit:applicationProfile>\r\n\s+<gco:CharacterString>WalOnMap</gco:CharacterString>\r\n\s+</cit:applicationProfile>\r\n\s+<cit:applicationProfile>\r\n\s+<gco:CharacterString>WalOnMap</gco:CharacterString>\r\n\s+</cit:applicationProfile>');
UPDATE metadata SET data = regexp_replace(data,'<cit:applicationProfile>\r\n\s+<gco:CharacterString>WalOnMap</gco:CharacterString>\r\n\s+</cit:applicationProfile>\r\n\s+<cit:applicationProfile>\r\n\s+<gco:CharacterString>WalOnMap</gco:CharacterString>\r\n\s+</cit:applicationProfile>','<cit:applicationProfile><gco:CharacterString>WalOnMap</gco:CharacterString></cit:applicationProfile>') WHERE regexp_like(data, '<cit:applicationProfile>\r\n\s+<gco:CharacterString>WalOnMap</gco:CharacterString>\r\n\s+</cit:applicationProfile>\r\n\s+<cit:applicationProfile>\r\n\s+<gco:CharacterString>WalOnMap</gco:CharacterString>\r\n\s+</cit:applicationProfile>')

@GeryNi : à tester sur nouvelle BD TEST

GeryNi commented 3 weeks ago

Pour postgresql 13: Suite à investigation avec Francois, voci les requêtes DB pour trouver et corriger les fiches:

SELECT COUNT(uuid) FROM metadata WHERE data ~ '<cit:applicationProfile>\r\n\s+<gco:CharacterString>WalOnMap</gco:CharacterString>\r\n\s+</cit:applicationProfile>\r\n\s+<cit:applicationProfile>\r\n\s+<gco:CharacterString>WalOnMap</gco:CharacterString>\r\n\s+</cit:applicationProfile>';
UPDATE metadata SET data = regexp_replace(data,'<cit:applicationProfile>\r\n\s+<gco:CharacterString>WalOnMap</gco:CharacterString>\r\n\s+</cit:applicationProfile>\r\n\s+<cit:applicationProfile>\r\n\s+<gco:CharacterString>WalOnMap</gco:CharacterString>\r\n\s+</cit:applicationProfile>','<cit:applicationProfile><gco:CharacterString>WalOnMap</gco:CharacterString></cit:applicationProfile>') WHERE data ~ '<cit:applicationProfile>\r\n\s+<gco:CharacterString>WalOnMap</gco:CharacterString>\r\n\s+</cit:applicationProfile>\r\n\s+<cit:applicationProfile>\r\n\s+<gco:CharacterString>WalOnMap</gco:CharacterString>\r\n\s+</cit:applicationProfile>';

@GeryNi : à tester sur nouvelle BD TEST

GeryNi commented 3 weeks ago

https://metawal.test.wallonie.be/geonetwork/srv/api/records/e6c8d704-375a-4e09-a130-f1f1de376e9a/formatters/xml