geonetwork / geonetwork/core-geonetwork

Facets - aggLang variable it's not always replaced properly producing different results in the search filters

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

Description

**Describe the bug**

When configuring a facet with `aggLang` variable

```
"OrgForResource": {
"terms": {
"field": "OrgForResourceObject.${aggLang}",
"include": ".*",
"size": 20
},
"meta": {
"caseInsensitiveInclude": true
}
},
```

This code calculates the value to replace in `aggLanguage`

https://github.com/geonetwork/core-geonetwork/blob/16df8661ea18dfbe36e976bc5f7bdbe4ac829e44/web-ui/src/main/resources/catalog/components/elasticsearch/EsService.js#L47-L93

Sometimes the parameter `state` only contains a property `filter` and others contains additional properties like `languageStrategy` that causes different output.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to https://apps.titellus.net/geonetwork/srv/dut/catalog.search#/home (Dutch UI) and select from the menu the search option `Zoeken` --> The Organisation facet is displayed

The search request request the aggregation field `OrgForResourceObject.default`

2. In other tab open the search page in Dutch --> https://apps.titellus.net/geonetwork/srv/dut/catalog.search#/search --> The organisation facet is not displayed

The search request request the aggregation field `OrgForResourceObject.langdut`

**Expected behavior**
Results are the same.

---

This code probably should be initialised with the settings values for `languageStrategy` and other fields:

https://github.com/geonetwork/core-geonetwork/blob/16df8661ea18dfbe36e976bc5f7bdbe4ac829e44/web-ui/src/main/resources/catalog/components/search/searchmanager/SearchFormDirective.js#L64-L66

It's unclear in case 1. how is filled, as the code that seems to fill that object it's not executed:

https://github.com/geonetwork/core-geonetwork/blob/16df8661ea18dfbe36e976bc5f7bdbe4ac829e44/web-ui/src/main/resources/catalog/components/search/searchmanager/SearchFormDirective.js#L372-L380

@fxprunayre any idea about this?

Contributor guide

Open the contributing guide

Research direction

Start in web-ui/src/main/resources/catalog/components/elasticsearch/EsService.js at the aggLang replacement logic, then trace the state initialization and update paths in searchmanager/SearchFormDirective.js. Reproduce the two Dutch search-page flows and compare their aggregation requests. Done means both flows produce the same expected aggregation field and facet results.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend, search
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.