This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository coselmar. See https://gitlab.nuiton.org/codelutin/coselmar.git commit 00feca5911709ef9b8d2133e87732606f6d485d1 Author: Yannick Martel <martel@©odelutin.com> Date: Wed May 24 13:17:44 2017 +0200 prevent NPE --- .../indexation/QuestionsIndexationService.java | 30 ++++++++++++---------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/coselmar-rest/src/main/java/fr/ifremer/coselmar/services/indexation/QuestionsIndexationService.java b/coselmar-rest/src/main/java/fr/ifremer/coselmar/services/indexation/QuestionsIndexationService.java index 32bb35b..fab643b 100644 --- a/coselmar-rest/src/main/java/fr/ifremer/coselmar/services/indexation/QuestionsIndexationService.java +++ b/coselmar-rest/src/main/java/fr/ifremer/coselmar/services/indexation/QuestionsIndexationService.java @@ -326,22 +326,24 @@ public class QuestionsIndexationService extends CoselmarSimpleServiceSupport { for (ScoreDoc scoreDoc : scoreDocs) { Fields termVectors = ireader.getTermVectors(scoreDoc.doc); - for (String termVector : termVectors) { - Terms vector = ireader.getTermVector(scoreDoc.doc, termVector); - TermsEnum termsEnum = vector.iterator(); - BytesRef bytesRef = termsEnum.next(); - while(bytesRef != null){ - String term = bytesRef.utf8ToString().toLowerCase(); - long totalTermFreq = termsEnum.totalTermFreq(); - - if (term.length() > TransverseIndexationService.CLOUD_TAG_WORD_MIN_SIZE) { - if (result.containsKey(term)) { - result.put(term, result.get(term) + totalTermFreq); - } else { - result.put(term, totalTermFreq); + if (termVectors != null) { + for (String termVector : termVectors) { + Terms vector = ireader.getTermVector(scoreDoc.doc, termVector); + TermsEnum termsEnum = vector.iterator(); + BytesRef bytesRef = termsEnum.next(); + while(bytesRef != null){ + String term = bytesRef.utf8ToString().toLowerCase(); + long totalTermFreq = termsEnum.totalTermFreq(); + + if (term.length() > TransverseIndexationService.CLOUD_TAG_WORD_MIN_SIZE) { + if (result.containsKey(term)) { + result.put(term, result.get(term) + totalTermFreq); + } else { + result.put(term, totalTermFreq); + } } + bytesRef = termsEnum.next(); } - bytesRef = termsEnum.next(); } } } -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.