Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
josegar74 opened this issue Jul 28, 2023 · 0 comments
Milestone

Comments

@josegar74
Copy link
Member

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

this.getLanguageConfig = function (any, state) {
var languageFound = false,
searchLanguage = "lang" + state.forcedLanguage,
uiLanguage = "lang" + gnGlobalSettings.iso3lang,
aggLanguage = "lang" + gnGlobalSettings.iso3lang;
state.detectedLanguage = undefined;
if (state.forcedLanguage !== undefined) {
searchLanguage = aggLanguage = "lang" + state.forcedLanguage;
languageFound = true;
} else if (state.languageStrategy === "searchInDetectedLanguage") {
searchLanguage = this.autoDetectLanguage(any || "", state.languageWhiteList);
state.detectedLanguage = searchLanguage;
languageFound = searchLanguage !== "und";
if (languageFound) {
searchLanguage = aggLanguage = "lang" + searchLanguage;
} else {
searchLanguage = "\\*";
}
} else if (state.languageStrategy === "searchInUILanguage") {
searchLanguage = aggLanguage = uiLanguage;
languageFound = true;
} else if (
state.languageStrategy &&
state.languageStrategy.indexOf("searchInThatLanguage") === 0
) {
var config = state.languageStrategy.split(":");
if (config.length !== 2) {
console.warn(
"When using language strategy searchInThatLanguage, configuration MUST be like searchInThatLanguage:fre"
);
} else {
searchLanguage = aggLanguage = "lang" + config[1];
languageFound = true;
}
} else if (state.languageStrategy === "searchInAllLanguages") {
languageFound = false;
searchLanguage = "\\*";
uiLanguage = "\\*";
aggLanguage = "default";
}
return {
languageFound: languageFound,
searchLanguage: searchLanguage,
uiLanguage: uiLanguage,
aggLanguage: aggLanguage
};
};

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

  1. 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:

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

$scope.searchObj.state = {
filters: {},
exactMatch: false,
titleOnly: false,
languageStrategy: "searchInAllLanguages",
forcedLanguage: undefined,
languageWhiteList: undefined,
detectedLanguage: undefined
};

@fxprunayre any idea about this?

@josegar74 josegar74 added this to the 4.4.0 milestone Jul 28, 2023
fxprunayre added a commit that referenced this issue Aug 24, 2023
Declare dutch language field for organisation to be able to create facet on this field.  

It may help fixing #7252
josegar74 pushed a commit that referenced this issue Aug 24, 2023
Declare dutch language field for organisation to be able to create facet on this field.  

It may help fixing #7252
josegar74 pushed a commit that referenced this issue Aug 24, 2023
Declare dutch language field for organisation to be able to create facet on this field.

It may help fixing #7252
@fxprunayre fxprunayre modified the milestones: 4.4.0, 4.4.1 Oct 4, 2023
@fxprunayre fxprunayre modified the milestones: 4.4.1, 4.4.2 Nov 22, 2023
@fxprunayre fxprunayre modified the milestones: 4.4.2, 4.4.3 Jan 23, 2024
@fxprunayre fxprunayre modified the milestones: 4.4.3, 4.4.4 Mar 14, 2024
@fxprunayre fxprunayre modified the milestones: 4.4.4, 4.4.5 Apr 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants