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 7c0480d6a3a56791c1888aec0a67049bd6f2b50a Author: Yannick Martel <martel@©odelutin.com> Date: Thu Jan 8 11:36:47 2015 +0100 add privacy and status as indexed property for question, and use QuestionSearchBean for lucene question search --- .../indexation/QuestionsIndexationService.java | 77 +++++++++++---- .../coselmar/services/v1/QuestionsWebService.java | 71 +++++++++++++- .../indexation/QuestionsIndexationServiceTest.java | 106 +++++++++++++++++---- 3 files changed, 212 insertions(+), 42 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 a1f1773..475559c 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 @@ -6,7 +6,9 @@ import java.util.List; import java.util.Set; import fr.ifremer.coselmar.beans.QuestionBean; +import fr.ifremer.coselmar.beans.QuestionSearchBean; import fr.ifremer.coselmar.services.CoselmarSimpleServiceSupport; +import org.apache.commons.lang3.StringUtils; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; import org.apache.lucene.document.StringField; @@ -41,6 +43,8 @@ public class QuestionsIndexationService extends CoselmarSimpleServiceSupport { protected static final String QUESTION_TITLE_INDEX_PROPERTY = "questionTitle"; protected static final String QUESTION_SUMMARY_INDEX_PROPERTY = "questionSummary"; protected static final String QUESTION_THEME_INDEX_PROPERTY = "questionTheme"; + protected static final String QUESTION_STATUS_INDEX_PROPERTY = "questionStatus"; + protected static final String QUESTION_PRIVACY_INDEX_PROPERTY = "questionPrivacy"; protected static final String DOCUMENT_TYPE = "question"; public void indexQuestion(QuestionBean question) throws IOException { @@ -69,6 +73,12 @@ public class QuestionsIndexationService extends CoselmarSimpleServiceSupport { doc.add(new Field(QUESTION_THEME_INDEX_PROPERTY, theme, TextField.TYPE_STORED)); } + doc.removeField(QUESTION_STATUS_INDEX_PROPERTY); + doc.add(new TextField(QUESTION_STATUS_INDEX_PROPERTY, question.getStatus(), Field.Store.YES)); + + doc.removeField(QUESTION_PRIVACY_INDEX_PROPERTY); + doc.add(new TextField(QUESTION_PRIVACY_INDEX_PROPERTY, question.getPrivacy(), Field.Store.YES)); + getLuceneUtils().getIndexWriter().updateDocument(new Term(QUESTION_ID_INDEX_PROPERTY, question.getId()), doc); } else { @@ -79,13 +89,17 @@ public class QuestionsIndexationService extends CoselmarSimpleServiceSupport { doc.add(new TextField(QUESTION_TITLE_INDEX_PROPERTY, question.getTitle(), Field.Store.YES)); doc.add(new TextField(QUESTION_SUMMARY_INDEX_PROPERTY, question.getSummary(), Field.Store.YES)); - doc.add(new Field("type", DOCUMENT_TYPE, TextField.TYPE_STORED)); + + doc.add(new TextField(QUESTION_STATUS_INDEX_PROPERTY, question.getStatus(), Field.Store.YES)); + doc.add(new TextField(QUESTION_PRIVACY_INDEX_PROPERTY, question.getPrivacy(), Field.Store.YES)); Set<String> themes = question.getThemes(); for (String theme : themes) { doc.add(new Field(QUESTION_THEME_INDEX_PROPERTY, theme, TextField.TYPE_STORED)); } + doc.add(new Field("type", DOCUMENT_TYPE, TextField.TYPE_STORED)); + getLuceneUtils().getIndexWriter().addDocument(doc); } @@ -96,35 +110,58 @@ public class QuestionsIndexationService extends CoselmarSimpleServiceSupport { } - public List<String> searchQuestion(String text) throws IOException, ParseException { + public List<String> searchQuestion(QuestionSearchBean searchBean) throws IOException, ParseException { DirectoryReader ireader = DirectoryReader.open(getLuceneUtils().getIndexWriter(), false); IndexSearcher isearcher = new IndexSearcher(ireader); - String[] words = text.replaceAll("[^a-zA-Z ]", "").toLowerCase().split(" "); - - // Parse a simple query that searches for the "text": - BooleanQuery query = new BooleanQuery(); + // Combine that with the type + BooleanQuery fullQuery = new BooleanQuery(); + fullQuery.add(new TermQuery(new Term("type", DOCUMENT_TYPE)), BooleanClause.Occur.MUST); - PhraseQuery nameQuery = new PhraseQuery(); - PhraseQuery summaryQuery = new PhraseQuery(); - PhraseQuery authorsQuery = new PhraseQuery(); + String searchPrivacy = searchBean.getPrivacy(); + if(StringUtils.isNotBlank(searchPrivacy)) { + fullQuery.add(new TermQuery(new Term(QUESTION_PRIVACY_INDEX_PROPERTY, searchPrivacy.toLowerCase())), BooleanClause.Occur.MUST); + } - for (String word : words) { - nameQuery.add(new Term(QUESTION_TITLE_INDEX_PROPERTY, word.toLowerCase())); - summaryQuery.add(new Term(QUESTION_SUMMARY_INDEX_PROPERTY, word.toLowerCase())); + String searchStatus = searchBean.getStatus(); + if(StringUtils.isNotBlank(searchStatus)) { + fullQuery.add(new TermQuery(new Term(QUESTION_STATUS_INDEX_PROPERTY, searchStatus.toLowerCase())), BooleanClause.Occur.MUST); } - query.add(nameQuery, BooleanClause.Occur.SHOULD); - query.add(summaryQuery, BooleanClause.Occur.SHOULD); - query.add(authorsQuery, BooleanClause.Occur.SHOULD); + // Keywords part + List<String> keywords = searchBean.getKeywords(); + if (keywords != null && !keywords.isEmpty()) { + BooleanQuery keywordsQuery = new BooleanQuery(); - query.add(new TermQuery(new Term(QUESTION_THEME_INDEX_PROPERTY, text.toLowerCase())), BooleanClause.Occur.SHOULD); + for (String text : keywords) { + String[] words = text.replaceAll("[^a-zA-Z ]", "").toLowerCase().split(" "); + + // Parse a simple query that searches for the "text": + BooleanQuery query = new BooleanQuery(); + + PhraseQuery nameQuery = new PhraseQuery(); + PhraseQuery summaryQuery = new PhraseQuery(); + PhraseQuery authorsQuery = new PhraseQuery(); + + for (String word : words) { + nameQuery.add(new Term(QUESTION_TITLE_INDEX_PROPERTY, word.toLowerCase())); + summaryQuery.add(new Term(QUESTION_SUMMARY_INDEX_PROPERTY, word.toLowerCase())); + } + + query.add(nameQuery, BooleanClause.Occur.SHOULD); + query.add(summaryQuery, BooleanClause.Occur.SHOULD); + query.add(authorsQuery, BooleanClause.Occur.SHOULD); + + query.add(new TermQuery(new Term(QUESTION_THEME_INDEX_PROPERTY, text.toLowerCase())), BooleanClause.Occur.SHOULD); + + keywordsQuery.add(query, BooleanClause.Occur.MUST); + } + + // add to complete query + fullQuery.add(keywordsQuery, BooleanClause.Occur.MUST); + } - // Combine that with the type - BooleanQuery fullQuery = new BooleanQuery(); - fullQuery.add(query, BooleanClause.Occur.MUST); - fullQuery.add(new TermQuery(new Term("type", DOCUMENT_TYPE)), BooleanClause.Occur.MUST); ScoreDoc[] hits = isearcher.search(fullQuery, null, 1000).scoreDocs; diff --git a/coselmar-rest/src/main/java/fr/ifremer/coselmar/services/v1/QuestionsWebService.java b/coselmar-rest/src/main/java/fr/ifremer/coselmar/services/v1/QuestionsWebService.java index 57ad349..05ce72e 100644 --- a/coselmar-rest/src/main/java/fr/ifremer/coselmar/services/v1/QuestionsWebService.java +++ b/coselmar-rest/src/main/java/fr/ifremer/coselmar/services/v1/QuestionsWebService.java @@ -55,8 +55,10 @@ import fr.ifremer.coselmar.services.indexation.QuestionsIndexationService; import org.apache.commons.lang3.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.apache.lucene.queryparser.classic.ParseException; import org.nuiton.topia.persistence.TopiaIdFactory; import org.nuiton.topia.persistence.TopiaNoResultException; +import org.nuiton.topia.persistence.TopiaQueryBuilderAddCriteriaOrRunQueryStep; /** * @author ymartel <martel@codelutin.com> @@ -870,17 +872,69 @@ public class QuestionsWebService extends CoselmarWebServiceSupport { */ protected List<Question> getAllFilteredQuestions(CoselmarUser currentUser, QuestionSearchBean searchBean) throws UnauthorizedException { String currentUserRole = currentUser.getRole().name(); + QuestionsIndexationService questionsIndexationService = getServicesContext().newService(QuestionsIndexationService.class); List<Question> questionList; if (StringUtils.equalsIgnoreCase(CoselmarUserRole.ADMIN.name(), currentUserRole) || StringUtils.equalsIgnoreCase(CoselmarUserRole.SUPERVISOR.name(), currentUserRole)) { - questionList = getQuestionDao().findWithSearchBean(searchBean); + + if (searchBean != null && searchBean.getKeywords() != null && !searchBean.getKeywords().isEmpty()) { + try { + //TODO martel 20150106 : maybe its should be better if privacy and status are indexed too ? + List<String> questionIds = questionsIndexationService.searchQuestion(searchBean); + List<String> questionFullIds = getQuestionsFullId(questionIds); + TopiaQueryBuilderAddCriteriaOrRunQueryStep<Question> queryBuilder = getQuestionDao().forTopiaIdIn(questionFullIds); + if (StringUtils.isNotBlank(searchBean.getPrivacy())) { + queryBuilder.addEquals(Question.PROPERTY_PRIVACY, Privacy.valueOf(searchBean.getPrivacy().toUpperCase())); + } + if (StringUtils.isNotBlank(searchBean.getStatus())) { + queryBuilder.addEquals(Question.PROPERTY_STATUS, Privacy.valueOf(searchBean.getStatus().toUpperCase())); + } + questionList = queryBuilder.findAll(); + + } catch (IOException |ParseException e) { + if (log.isErrorEnabled()) { + log.error("Unable to search by lucene, make search directly in database", e); + } + questionList = getQuestionDao().findWithSearchBean(searchBean); + } + + // classical search with DAO + } else { + questionList = getQuestionDao().findWithSearchBean(searchBean); + + } } else if (StringUtils.equalsIgnoreCase(CoselmarUserRole.MEMBER.name(), currentUserRole)) { if (StringUtils.equals(searchBean.getPrivacy(), Privacy.PRIVATE.name())) { questionList = new ArrayList<>(0); } else { - questionList = getQuestionDao().findWithSearchBean(searchBean); + + if (searchBean != null && searchBean.getKeywords() != null && !searchBean.getKeywords().isEmpty()) { + try { + //TODO martel 20150106 : maybe its should be better if privacy and status are indexed too ? + List<String> questionIds = questionsIndexationService.searchQuestion(searchBean); + List<String> questionFullIds = getQuestionsFullId(questionIds); + TopiaQueryBuilderAddCriteriaOrRunQueryStep<Question> queryBuilder = getQuestionDao().forTopiaIdIn(questionFullIds); + if (StringUtils.isNotBlank(searchBean.getPrivacy())) { + queryBuilder.addEquals(Question.PROPERTY_PRIVACY, Privacy.valueOf(searchBean.getPrivacy().toUpperCase())); + } + if (StringUtils.isNotBlank(searchBean.getStatus())) { + queryBuilder.addEquals(Question.PROPERTY_STATUS, Privacy.valueOf(searchBean.getStatus().toUpperCase())); + } + questionList = queryBuilder.findAll(); + + } catch (IOException |ParseException e) { + if (log.isErrorEnabled()) { + log.error("Unable to search by lucene, make search directly in database", e); + } + questionList = getQuestionDao().findWithSearchBean(searchBean); + } + + // classical search with DAO + } else { + questionList = getQuestionDao().findWithSearchBean(searchBean); + } } } else if (StringUtils.equalsIgnoreCase(CoselmarUserRole.EXPERT.name(), currentUserRole)) { @@ -898,4 +952,17 @@ public class QuestionsWebService extends CoselmarWebServiceSupport { return questionList; } + protected List<String> getQuestionsFullId(List<String> questionShortIds) { + + Function<String, String> getFullIds = new Function<String, String>() { + @Override + public String apply(String shortId) { + return Question.class.getCanonicalName() + getPersistenceContext().getTopiaIdFactory().getSeparator() + shortId; + } + }; + + List<String> fullIds = Lists.transform(questionShortIds, getFullIds); + return fullIds; + } + } 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 d6175e8..9f486bc 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 @@ -1,11 +1,13 @@ package fr.ifremer.coselmar.services.indexation; +import java.util.Arrays; import java.util.Date; import java.util.List; import java.util.Locale; import com.google.common.collect.Sets; import fr.ifremer.coselmar.beans.QuestionBean; +import fr.ifremer.coselmar.beans.QuestionSearchBean; import fr.ifremer.coselmar.persistence.entity.Privacy; import fr.ifremer.coselmar.persistence.entity.Status; import fr.ifremer.coselmar.services.AbstractCoselmarServiceTest; @@ -87,7 +89,7 @@ public class QuestionsIndexationServiceTest extends AbstractCoselmarServiceTest questionThree.setDeadline(DateUtil.createDateAfterToday(16, 0, 0)); questionThree.setSubmissionDate(new Date()); questionThree.setStatus(Status.OPEN.name()); - questionThree.setPrivacy(Privacy.PUBLIC.name()); + questionThree.setPrivacy(Privacy.PRIVATE.name()); questionThree.setThemes(Sets.newHashSet("big bang two", "Pandorica", "River", "Universe")); @@ -100,37 +102,81 @@ public class QuestionsIndexationServiceTest extends AbstractCoselmarServiceTest questionsIndexationService.indexQuestion(questionThree); // Ok, let's search now ! - List<String> questionMatchingTitleIds = questionsIndexationService.searchQuestion("ultimate"); + QuestionSearchBean searchBean = new QuestionSearchBean(); + searchBean.setKeywords(Arrays.asList("ultimate")); + List<String> questionMatchingTitleIds = questionsIndexationService.searchQuestion(searchBean); Assert.assertEquals(1, questionMatchingTitleIds.size()); Assert.assertEquals(questionTwoId, questionMatchingTitleIds.get(0)); - List<String> questionMatchingAmyIds = questionsIndexationService.searchQuestion("amy"); + searchBean.setKeywords(Arrays.asList("amy")); + List<String> questionMatchingAmyIds = questionsIndexationService.searchQuestion(searchBean); Assert.assertTrue(questionMatchingAmyIds.isEmpty()); - List<String> questionMatchingPandoricaIds = questionsIndexationService.searchQuestion("Pandorica"); + searchBean.setKeywords(Arrays.asList("Pandorica")); + List<String> questionMatchingPandoricaIds = questionsIndexationService.searchQuestion(searchBean); Assert.assertEquals(1, questionMatchingPandoricaIds.size()); Assert.assertEquals(questionThreeId, questionMatchingPandoricaIds.get(0)); - List<String> questionMatchingUniverseIds = questionsIndexationService.searchQuestion("universe"); + searchBean.setKeywords(Arrays.asList("universe")); + List<String> questionMatchingUniverseIds = questionsIndexationService.searchQuestion(searchBean); Assert.assertEquals(2, questionMatchingUniverseIds.size()); Assert.assertTrue(questionMatchingUniverseIds.contains(questionThreeId)); Assert.assertTrue(questionMatchingUniverseIds.contains(questionOneId)); - List<String> documentMatchingUnknownIds = questionsIndexationService.searchQuestion("Unknown"); + searchBean.setKeywords(Arrays.asList("universe", "someone")); + List<String> questionMatchingUniverseAndSomeoneIds = questionsIndexationService.searchQuestion(searchBean); + Assert.assertEquals(1, questionMatchingUniverseAndSomeoneIds.size()); + Assert.assertEquals(questionThreeId, questionMatchingUniverseAndSomeoneIds.get(0)); + + searchBean.setKeywords(Arrays.asList("Unknown")); + List<String> documentMatchingUnknownIds = questionsIndexationService.searchQuestion(searchBean); Assert.assertTrue(documentMatchingUnknownIds.isEmpty()); - List<String> documentMatchingPartOfSummaryIds = questionsIndexationService.searchQuestion("Something blue"); + searchBean.setKeywords(Arrays.asList("Something blue")); + List<String> documentMatchingPartOfSummaryIds = questionsIndexationService.searchQuestion(searchBean); Assert.assertEquals(1, documentMatchingPartOfSummaryIds.size()); Assert.assertEquals(questionThreeId, documentMatchingPartOfSummaryIds.get(0)); - documentMatchingPartOfSummaryIds = questionsIndexationService.searchQuestion("Something borrowed,"); + searchBean.setKeywords(Arrays.asList("Something borrowed,")); + documentMatchingPartOfSummaryIds = questionsIndexationService.searchQuestion(searchBean); Assert.assertEquals(1, documentMatchingPartOfSummaryIds.size()); Assert.assertEquals(questionThreeId, documentMatchingPartOfSummaryIds.get(0)); - documentMatchingPartOfSummaryIds = questionsIndexationService.searchQuestion("can we"); + searchBean.setKeywords(Arrays.asList("can we")); + documentMatchingPartOfSummaryIds = questionsIndexationService.searchQuestion(searchBean); Assert.assertEquals(1, documentMatchingPartOfSummaryIds.size()); Assert.assertEquals(questionOneId, documentMatchingPartOfSummaryIds.get(0)); + searchBean.setKeywords(null); + searchBean.setPrivacy(Privacy.PUBLIC.name()); + List<String> documentMatchingPrivacyIds = questionsIndexationService.searchQuestion(searchBean); + Assert.assertEquals(2, documentMatchingPrivacyIds.size()); + Assert.assertTrue(documentMatchingPrivacyIds.contains(questionOneId)); + Assert.assertTrue(documentMatchingPrivacyIds.contains(questionTwoId)); + + searchBean.setKeywords(null); + searchBean.setPrivacy(Privacy.PRIVATE.name()); + documentMatchingPrivacyIds = questionsIndexationService.searchQuestion(searchBean); + Assert.assertEquals(1, documentMatchingPrivacyIds.size()); + Assert.assertEquals(questionThreeId, documentMatchingPrivacyIds.get(0)); + + searchBean.setKeywords(Arrays.asList("Universe")); + searchBean.setPrivacy(Privacy.PUBLIC.name()); + List<String> documentMatchingPrivacyAndUniverseKeywordIds = questionsIndexationService.searchQuestion(searchBean); + Assert.assertEquals(1, documentMatchingPrivacyAndUniverseKeywordIds.size()); + Assert.assertEquals(questionOneId, documentMatchingPrivacyAndUniverseKeywordIds.get(0)); + + searchBean.setKeywords(Arrays.asList("Something blue")); + searchBean.setPrivacy(Privacy.PRIVATE.name()); + List<String> documentMatchingPrivacyAndPartOfSummaryIds = questionsIndexationService.searchQuestion(searchBean); + Assert.assertEquals(1, documentMatchingPrivacyAndPartOfSummaryIds.size()); + Assert.assertEquals(questionThreeId, documentMatchingPrivacyAndPartOfSummaryIds.get(0)); + + searchBean.setKeywords(Arrays.asList("Something blue")); + searchBean.setPrivacy(Privacy.PUBLIC.name()); + documentMatchingPrivacyAndPartOfSummaryIds = questionsIndexationService.searchQuestion(searchBean); + Assert.assertTrue(documentMatchingPrivacyAndPartOfSummaryIds.isEmpty()); + } @Test @@ -168,18 +214,29 @@ public class QuestionsIndexationServiceTest extends AbstractCoselmarServiceTest questionsIndexationService.indexQuestion(questionTwo); questionOne.setTitle("How old is the doctor who ?"); + questionOne.setPrivacy(Privacy.PRIVATE.name()); questionsIndexationService.indexQuestion(questionOne); // Ok, let's search now ! - List<String> questionMatchingTitleIds = questionsIndexationService.searchQuestion("awesome"); + QuestionSearchBean searchBean = new QuestionSearchBean(); + searchBean.setKeywords(Arrays.asList("awesome")); + List<String> questionMatchingTitleIds = questionsIndexationService.searchQuestion(searchBean); Assert.assertTrue(questionMatchingTitleIds.isEmpty()); - questionMatchingTitleIds = questionsIndexationService.searchQuestion("who"); + searchBean.setKeywords(Arrays.asList("who")); + questionMatchingTitleIds = questionsIndexationService.searchQuestion(searchBean); Assert.assertEquals(2, questionMatchingTitleIds.size()); Assert.assertTrue(questionMatchingTitleIds.contains(questionOneId)); Assert.assertTrue(questionMatchingTitleIds.contains(questionTwoId)); - questionMatchingTitleIds = questionsIndexationService.searchQuestion("doctor"); + searchBean.setKeywords(Arrays.asList("doctor")); + questionMatchingTitleIds = questionsIndexationService.searchQuestion(searchBean); + Assert.assertEquals(1, questionMatchingTitleIds.size()); + Assert.assertTrue(questionMatchingTitleIds.contains(questionOneId)); + + searchBean.setKeywords(null); + searchBean.setPrivacy(Privacy.PRIVATE.name()); + questionMatchingTitleIds = questionsIndexationService.searchQuestion(searchBean); Assert.assertEquals(1, questionMatchingTitleIds.size()); Assert.assertTrue(questionMatchingTitleIds.contains(questionOneId)); @@ -220,15 +277,19 @@ public class QuestionsIndexationServiceTest extends AbstractCoselmarServiceTest questionsIndexationService.indexQuestion(questionTwo); // Ok, let's search now ! - List<String> questionMatchingTitleIds = questionsIndexationService.searchQuestion("awesome"); + QuestionSearchBean searchBean = new QuestionSearchBean(); + searchBean.setKeywords(Arrays.asList("awesome")); + List<String> questionMatchingTitleIds = questionsIndexationService.searchQuestion(searchBean); Assert.assertEquals(1, questionMatchingTitleIds.size()); Assert.assertEquals(questionOneId, questionMatchingTitleIds.get(0)); - questionMatchingTitleIds = questionsIndexationService.searchQuestion("missing"); + searchBean.setKeywords(Arrays.asList("missing")); + questionMatchingTitleIds = questionsIndexationService.searchQuestion(searchBean); Assert.assertEquals(1, questionMatchingTitleIds.size()); Assert.assertEquals(questionTwoId, questionMatchingTitleIds.get(0)); - List<String> questionMatchingUniverseIds = questionsIndexationService.searchQuestion("universe"); + searchBean.setKeywords(Arrays.asList("universe")); + List<String> questionMatchingUniverseIds = questionsIndexationService.searchQuestion(searchBean); Assert.assertEquals(2, questionMatchingUniverseIds.size()); Assert.assertTrue(questionMatchingUniverseIds.contains(questionOneId)); Assert.assertTrue(questionMatchingUniverseIds.contains(questionTwoId)); @@ -237,22 +298,27 @@ public class QuestionsIndexationServiceTest extends AbstractCoselmarServiceTest questionsIndexationService.deleteQuestion(questionOneId); // and let's search same now ! - questionMatchingTitleIds = questionsIndexationService.searchQuestion("awesome"); + searchBean.setKeywords(Arrays.asList("awesome")); + questionMatchingTitleIds = questionsIndexationService.searchQuestion(searchBean); Assert.assertTrue(questionMatchingTitleIds.isEmpty()); - questionMatchingTitleIds = questionsIndexationService.searchQuestion("missing"); + searchBean.setKeywords(Arrays.asList("missing")); + questionMatchingTitleIds = questionsIndexationService.searchQuestion(searchBean); Assert.assertEquals(1, questionMatchingTitleIds.size()); Assert.assertTrue(questionMatchingTitleIds.contains(questionTwoId)); - questionMatchingUniverseIds = questionsIndexationService.searchQuestion("universe"); + searchBean.setKeywords(Arrays.asList("universe")); + questionMatchingUniverseIds = questionsIndexationService.searchQuestion(searchBean); Assert.assertEquals(1, questionMatchingUniverseIds.size()); Assert.assertTrue(questionMatchingUniverseIds.contains(questionTwoId)); - List<String> documentMatchingPartOfSummaryIds = questionsIndexationService.searchQuestion("can we"); + searchBean.setKeywords(Arrays.asList("can we")); + List<String> documentMatchingPartOfSummaryIds = questionsIndexationService.searchQuestion(searchBean); Assert.assertTrue(documentMatchingPartOfSummaryIds.isEmpty()); - documentMatchingPartOfSummaryIds = questionsIndexationService.searchQuestion("Something blue"); + searchBean.setKeywords(Arrays.asList("Something blue")); + documentMatchingPartOfSummaryIds = questionsIndexationService.searchQuestion(searchBean); Assert.assertEquals(1, documentMatchingPartOfSummaryIds.size()); Assert.assertEquals(questionTwoId, documentMatchingPartOfSummaryIds.get(0)); -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.