geonetwork / geonetwork/core-geonetwork

Indexing stylesheet: gn-fn-index:json-escape deprecation / regression

Open
#7,563 29 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
521
Forks
514
Avg merge
6d 13h
Merged PRs (30d)
19

Description

**Describe the bug**
Harvesting file system XML leads to indexing error that does not occur with the same XML on v4.2.x

**To Reproduce**
File system harvester with given XML file.

**Expected behavior**
Indexing succeeds as in stable version.

**Screenshots**
-

**Log file**
```
ERROR [geonetwork.index] - Indexing stylesheet contains errors: A sequence of more than one item is not allowed as the first argument of gn-fn-index:json-escape() ("", "")
Marking the metadata as _indexingError=1 in index
```

**Desktop (please complete the following information):**
- Browser: Firefox
- GeoNetwork: v4.4.1
- Server Application Jetty with Java 11

**Additional context**
I had a look into the offending function `json-escape` and found a deprecation [comment](https://github.com/geonetwork/core-geonetwork/blob/065f88c11b1eed8742fd43a9dffd5121b7e7cf3a/web/src/main/webapp/xslt/common/index-utils.xsl#L686 ) so I first want to make sure that the issue is not about deprecation and leftover usage of that function during deprecation work. In case this is expected to work, I will experiment more with a reduced XML that still triggers the error.

*Edit*: For experimenting with reduced XML, I looked for repo tests to hook into. Is core-geonetwork\web\src\test\java\org\fao\geonet\xslt\common\ValidateSupportedEmailXslTest.java the correct place to look into as a test template?

Contributor guide

Open the contributing guide

Research direction

Start in web/src/main/webapp/xslt/common/index-utils.xsl around the json-escape deprecation comment, then reproduce the failure with the file-system harvester and reduced XML. Review ValidateSupportedEmailXslTest.java as the mentioned test template and compare behavior with v4.2.x. Done means indexing succeeds without the sequence error and the regression is covered by a test.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, xml
Domain
backend, search
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.