This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository coselmar. See http://git.codelutin.com/coselmar.git commit b612f7fc68c772a72413bc1b77e04a832eb5255a Author: Yannick Martel <martel@©odelutin.com> Date: Wed Jan 13 17:20:32 2016 +0100 fixes #7852 Suppression des mots de liaison *français* --- .../coselmar/services/indexation/LuceneUtils.java | 9 +++++++-- .../indexation/DocumentsIndexationServiceTest.java | 22 +++++++++++++++------- .../indexation/QuestionsIndexationServiceTest.java | 2 +- 3 files changed, 23 insertions(+), 10 deletions(-) diff --git a/coselmar-rest/src/main/java/fr/ifremer/coselmar/services/indexation/LuceneUtils.java b/coselmar-rest/src/main/java/fr/ifremer/coselmar/services/indexation/LuceneUtils.java index c471fac..96ce2e3 100644 --- a/coselmar-rest/src/main/java/fr/ifremer/coselmar/services/indexation/LuceneUtils.java +++ b/coselmar-rest/src/main/java/fr/ifremer/coselmar/services/indexation/LuceneUtils.java @@ -26,12 +26,17 @@ package fr.ifremer.coselmar.services.indexation; import java.io.File; import java.io.IOException; +import java.io.InputStreamReader; import fr.ifremer.coselmar.config.CoselmarServicesConfig; +import org.apache.commons.io.IOUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.lucene.analysis.Analyzer; import org.apache.lucene.analysis.core.SimpleAnalyzer; +import org.apache.lucene.analysis.fr.FrenchAnalyzer; +import org.apache.lucene.analysis.snowball.SnowballFilter; +import org.apache.lucene.analysis.standard.StandardAnalyzer; import org.apache.lucene.index.IndexWriter; import org.apache.lucene.index.IndexWriterConfig; import org.apache.lucene.store.Directory; @@ -56,9 +61,9 @@ public class LuceneUtils { protected Analyzer getAnalyzer() { if (analyzer == null) { -// analyzer = new StandardAnalyzer(); + analyzer = new StandardAnalyzer(FrenchAnalyzer.getDefaultStopSet()); //Use simple analyzer to index all words and be able to search with "close word" classified in StandardAnalyzer - analyzer = new SimpleAnalyzer(); +// analyzer = new SimpleAnalyzer(); } return analyzer; diff --git a/coselmar-rest/src/test/java/fr/ifremer/coselmar/services/indexation/DocumentsIndexationServiceTest.java b/coselmar-rest/src/test/java/fr/ifremer/coselmar/services/indexation/DocumentsIndexationServiceTest.java index c08624a..ee2311b 100644 --- a/coselmar-rest/src/test/java/fr/ifremer/coselmar/services/indexation/DocumentsIndexationServiceTest.java +++ b/coselmar-rest/src/test/java/fr/ifremer/coselmar/services/indexation/DocumentsIndexationServiceTest.java @@ -91,7 +91,9 @@ public class DocumentsIndexationServiceTest extends AbstractCoselmarServiceTest List<String> documentMatchingTheMasterIds = documentsIndexationService.searchDocuments("the Master"); Assert.assertTrue(documentMatchingTheMasterIds.isEmpty()); - List<String> documentMatchingPartOfSummaryIds = documentsIndexationService.searchDocuments("This is part of"); + // change with 1.2 and change on analyzer : SimpleAnalyzer-> StandardAnalyzer +// List<String> documentMatchingPartOfSummaryIds = documentsIndexationService.searchDocuments("This is part of"); + List<String> documentMatchingPartOfSummaryIds = documentsIndexationService.searchDocuments("part"); Assert.assertEquals(1, documentMatchingPartOfSummaryIds.size()); Assert.assertEquals("document3", documentMatchingPartOfSummaryIds.get(0)); @@ -99,7 +101,9 @@ public class DocumentsIndexationServiceTest extends AbstractCoselmarServiceTest Assert.assertEquals(1, documentMatchingPartOfWordIds.size()); Assert.assertEquals("document3", documentMatchingPartOfWordIds.get(0)); - documentMatchingPartOfWordIds = documentsIndexationService.searchDocuments("Thi"); + // change with 1.2 and change on analyzer : SimpleAnalyzer-> StandardAnalyzer +// documentMatchingPartOfWordIds = documentsIndexationService.searchDocuments("Thi"); + documentMatchingPartOfWordIds = documentsIndexationService.searchDocuments("Docum"); Assert.assertEquals(3, documentMatchingPartOfWordIds.size()); Assert.assertTrue(documentMatchingPartOfWordIds.contains("document1")); Assert.assertTrue(documentMatchingPartOfWordIds.contains("document2")); @@ -133,14 +137,16 @@ public class DocumentsIndexationServiceTest extends AbstractCoselmarServiceTest List<String> documentMatchingTheMasterIds = documentsIndexationService.searchDocuments("James"); Assert.assertTrue(documentMatchingTheMasterIds.isEmpty()); - List<String> documentMatchingPartOfSummaryIds = documentsIndexationService.searchDocuments("This is not a fake document"); +// List<String> documentMatchingPartOfSummaryIds = documentsIndexationService.searchDocuments("This is not a fake document"); + List<String> documentMatchingPartOfSummaryIds = documentsIndexationService.searchDocuments("fake document"); Assert.assertEquals(1, documentMatchingPartOfSummaryIds.size()); Assert.assertEquals("document1", documentMatchingPartOfSummaryIds.get(0)); documentOne = new DocumentBean("document1", "Doc Premier", "John Doe", "user001", Privacy.PUBLIC.name(), new Date(), Lists.newArrayList("test", "update"), "testDocument", - "This is a fake doc updated for test", "fr", null, "James, JJ", +// "This is a fake doc updated for test", "fr", null, "James, JJ", + "This is a faked doct updated for test", "fr", null, "James, JJ", null, null, false, null, "http://somewhere", "no comment", null); documentsIndexationService.updateDocument(documentOne); @@ -155,10 +161,12 @@ public class DocumentsIndexationServiceTest extends AbstractCoselmarServiceTest Assert.assertEquals(1, documentMatchingTheMasterIds.size()); Assert.assertEquals("document1", documentMatchingTheMasterIds.get(0)); - documentMatchingPartOfSummaryIds = documentsIndexationService.searchDocuments("This is not a fake document"); +// documentMatchingPartOfSummaryIds = documentsIndexationService.searchDocuments("This is not a fake document"); + documentMatchingPartOfSummaryIds = documentsIndexationService.searchDocuments("fake document"); Assert.assertTrue(documentMatchingPartOfSummaryIds.isEmpty()); - documentMatchingPartOfSummaryIds = documentsIndexationService.searchDocuments("This is a fake doc"); +// documentMatchingPartOfSummaryIds = documentsIndexationService.searchDocuments("This is a fake doc"); + documentMatchingPartOfSummaryIds = documentsIndexationService.searchDocuments("fake doct"); Assert.assertEquals(1, documentMatchingPartOfSummaryIds.size()); Assert.assertEquals("document1", documentMatchingPartOfSummaryIds.get(0)); @@ -194,7 +202,7 @@ public class DocumentsIndexationServiceTest extends AbstractCoselmarServiceTest List<String> documentMatchingTheMasterIds = documentsIndexationService.searchDocuments("Another"); Assert.assertTrue(documentMatchingTheMasterIds.isEmpty()); - List<String> documentMatchingPartOfSummaryIds = documentsIndexationService.searchDocuments("This is part of"); + List<String> documentMatchingPartOfSummaryIds = documentsIndexationService.searchDocuments("part"); Assert.assertEquals(1, documentMatchingPartOfSummaryIds.size()); Assert.assertEquals("document3", documentMatchingPartOfSummaryIds.get(0)); diff --git a/coselmar-rest/src/test/java/fr/ifremer/coselmar/services/indexation/QuestionsIndexationServiceTest.java b/coselmar-rest/src/test/java/fr/ifremer/coselmar/services/indexation/QuestionsIndexationServiceTest.java index b3c6334..df99838 100644 --- a/coselmar-rest/src/test/java/fr/ifremer/coselmar/services/indexation/QuestionsIndexationServiceTest.java +++ b/coselmar-rest/src/test/java/fr/ifremer/coselmar/services/indexation/QuestionsIndexationServiceTest.java @@ -400,7 +400,7 @@ public class QuestionsIndexationServiceTest extends AbstractCoselmarServiceTest QuestionBean questionThree = new QuestionBean(); String questionThreeId = "question_3_test_search" + System.currentTimeMillis(); questionThree.setId(questionThreeId); - questionThree.setTitle("There's someone missing. The question's Who?"); + questionThree.setTitle("There's someone missing. The question 's Who?"); questionThree.setSummary("Something old, Something new, Something borrowed, Something blue."); questionThree.setDeadline(DateUtil.createDateAfterToday(16, 0, 0)); questionThree.setSubmissionDate(new Date()); -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.