Skip to content

Commit

Permalink
fixing bug #9772 : removing useless session cache
Browse files Browse the repository at this point in the history
  • Loading branch information
NicolasEYSSERIC committed Oct 22, 2019
1 parent 895f155 commit c68886f
Showing 1 changed file with 9 additions and 17 deletions.
Expand Up @@ -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<String, Collection<String>> synonyms = new HashMap<>();

private boolean isThesaurusEnableByUser = false;

Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -1390,25 +1388,19 @@ private boolean isNotDeterminerOrLuceneCharacter(final String word) {
}

private Collection<String> getSynonym(String mot) {
if (synonyms.containsKey(mot)) {
return synonyms.get(mot);
} else {
try {
Collection<String> 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;
}
}
Expand Down

0 comments on commit c68886f

Please sign in to comment.