From c68886fd4612c67e8a63d92564d6e821d8c7c213 Mon Sep 17 00:00:00 2001 From: NicolasEysseric Date: Tue, 22 Oct 2019 18:41:21 +0200 Subject: [PATCH] fixing bug #9772 : removing useless session cache --- .../control/PdcSearchSessionController.java | 26 +++++++------------ 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/core-war/src/main/java/org/silverpeas/web/pdc/control/PdcSearchSessionController.java b/core-war/src/main/java/org/silverpeas/web/pdc/control/PdcSearchSessionController.java index 28e763ce2eb..89cedb7c3c5 100644 --- a/core-war/src/main/java/org/silverpeas/web/pdc/control/PdcSearchSessionController.java +++ b/core-war/src/main/java/org/silverpeas/web/pdc/control/PdcSearchSessionController.java @@ -208,7 +208,6 @@ public class PdcSearchSessionController extends AbstractComponentSessionControll private ThesaurusManager thesaurus = PdcServiceProvider.getThesaurusManager(); // Vocabulary used by the user private Jargon jargon = null; - private Map> synonyms = new HashMap<>(); private boolean isThesaurusEnableByUser = false; @@ -1314,8 +1313,7 @@ public boolean getActiveThesaurus() { public void initializeJargon() throws PdcException { try { - Jargon theJargon = thesaurus.getJargon(getUserId()); - this.jargon = theJargon; + this.jargon = thesaurus.getJargon(getUserId()); } catch (ThesaurusException e) { throw new PdcException(e); } @@ -1390,25 +1388,19 @@ private boolean isNotDeterminerOrLuceneCharacter(final String word) { } private Collection getSynonym(String mot) { - if (synonyms.containsKey(mot)) { - return synonyms.get(mot); - } else { - try { - Collection synos = thesaurus.getSynonyms(mot, getUserId()); - synonyms.put(mot, synos); - return synos; - } catch (ThesaurusException e) { - throw new PdcPeasRuntimeException( - "PdcSearchSessionController.getSynonym", SilverpeasException.ERROR, - "pdcPeas.EX_GET_SYNONYMS", e); - } + try { + return thesaurus.getSynonyms(mot, getUserId()); + } catch (ThesaurusException e) { + throw new PdcPeasRuntimeException( + "PdcSearchSessionController.getSynonym", SilverpeasException.ERROR, + "pdcPeas.EX_GET_SYNONYMS", e); } } private boolean isKeyword(String mot) { String[] keyWords = getStopWords(); - for (int i = 0; i < keyWords.length; i++) { - if (mot.equalsIgnoreCase(keyWords[i])) { + for (String keyword : keyWords) { + if (mot.equalsIgnoreCase(keyword)) { return true; } }