From 7d054efc1ced2c3f19c88eca4644bca06246efd4 Mon Sep 17 00:00:00 2001 From: Eva Vasques Date: Fri, 18 Mar 2022 17:34:24 +0000 Subject: [PATCH] Added unit test to replicate the issue --- .../resources/model/search-2139-model.xml | 12 ++++++++ .../search/FieldDefinitionTest.java | 28 ++++++++++++++++++- 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/e2e-test/src/main/resources/model/search-2139-model.xml b/e2e-test/src/main/resources/model/search-2139-model.xml index 76555ed20..9962ca916 100644 --- a/e2e-test/src/main/resources/model/search-2139-model.xml +++ b/e2e-test/src/main/resources/model/search-2139-model.xml @@ -126,6 +126,18 @@ true + + mltextMultiple + d:mltext + false + true + + true + false + both + true + + textPatternMany d:text diff --git a/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/FieldDefinitionTest.java b/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/FieldDefinitionTest.java index bb38e667d..a6f55bddd 100644 --- a/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/FieldDefinitionTest.java +++ b/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/FieldDefinitionTest.java @@ -26,6 +26,9 @@ package org.alfresco.test.search.functional.searchServices.search; +import java.util.ArrayList; +import java.util.List; + import org.alfresco.rest.search.SearchResponse; import org.alfresco.utility.data.CustomObjectTypeProperties; import org.alfresco.utility.model.FileModel; @@ -61,11 +64,17 @@ public class FieldDefinitionTest extends AbstractSearchServicesE2ETest { dataContent.usingUser(testUser).usingSite(testSite).createCustomContent(File2, "cmis:document", new CustomObjectTypeProperties()); + List mlMultipleValue = new ArrayList(); + mlMultipleValue.add("oranges"); + mlMultipleValue.add("apples"); + mlMultipleValue.add("pears"); + cmisApi.authenticateUser(testUser).usingResource(File2).addSecondaryTypes("P:allfieldtypes:text") .updateProperty("allfieldtypes:textFree", "text field definition test") .updateProperty("allfieldtypes:textPatternMany", "mltext field definition test") .updateProperty("allfieldtypes:textLOVWhole", "text field not tokenised") - .updateProperty("allfieldtypes:mltextLOVWhole", "mltext field not tokenised"); + .updateProperty("allfieldtypes:mltextLOVWhole", "mltext field not tokenised") + .updateProperty("allfieldtypes:multiplemltext", mlMultipleValue); waitForMetadataIndexing(File1.getName(), true); waitForMetadataIndexing(File2.getName(), true); @@ -198,4 +207,21 @@ public class FieldDefinitionTest extends AbstractSearchServicesE2ETest { restClient.assertStatusCodeIs(HttpStatus.OK); Assert.assertEquals(response.getPagination().getCount(), 0); } + + // A test to test the multiple mltext field in the solr schema + @Test(priority = 8) + public void testmlTextFieldMuliple() + { + SearchResponse response = queryAsUser(testUser, "allfieldtypes_multiplemltext:\"oranges\""); + restClient.assertStatusCodeIs(HttpStatus.OK); + Assert.assertEquals(response.getPagination().getCount(), 1); + + response = queryAsUser(testUser, "allfieldtypes_multiplemltext:\"apple\""); + restClient.assertStatusCodeIs(HttpStatus.OK); + Assert.assertEquals(response.getPagination().getCount(), 0); + + response = queryAsUser(testUser, "allfieldtypes_multiplemltext:\"pear\""); + restClient.assertStatusCodeIs(HttpStatus.OK); + Assert.assertEquals(response.getPagination().getCount(), 0); + } }