Added unit test to replicate the issue

This commit is contained in:
Eva Vasques
2022-03-18 17:34:24 +00:00
parent 33182be286
commit 7d054efc1c
2 changed files with 39 additions and 1 deletions
@@ -126,6 +126,18 @@
<facetable>true</facetable>
</index>
</property>
<property name="allfieldtypes:multiplemltext">
<title>mltextMultiple</title>
<type>d:mltext</type>
<mandatory>false</mandatory>
<multiple>true</multiple>
<index enabled="true">
<atomic>true</atomic>
<stored>false</stored>
<tokenised>both</tokenised>
<facetable>true</facetable>
</index>
</property>
<property name="allfieldtypes:textPatternMany">
<title>textPatternMany</title>
<type>d:text</type>
@@ -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<String> mlMultipleValue = new ArrayList<String>();
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);
}
}