mirror of
https://github.com/Alfresco/SearchServices.git
synced 2025-09-10 14:11:25 +00:00
MNT-22377 Fix search exact term queries using tokenised properties
Cherry picked from 1b68a63
This commit is contained in:
@@ -253,6 +253,7 @@ if __name__ == '__main__':
|
||||
parser.add_argument('-sr', '--shardRange', type=int, help='Total number of nodes per shard with DB_ID_RANGE sharding (default 800)')
|
||||
parser.add_argument('-ct', '--disableCascadeTracking', action='store_true', help='Cascade Tracking Disabled')
|
||||
parser.add_argument('-ef', '--enableFingerprint', action='store_true', help='Enable Fingerprint feature')
|
||||
parser.add_argument('-ecl', '--enableCrossLocale', action='store_true', help='Enable Cross Locale configuration')
|
||||
parser.add_argument('-sl', '--searchLogLevel', default='WARN', help='The log level for search (default WARN)',
|
||||
choices=['TRACE', 'DEBUG', 'INFO', 'WARN', 'ERROR'])
|
||||
parser.add_argument('-o', '--output', default='.', help='The path of the directory to output to')
|
||||
@@ -288,6 +289,7 @@ if __name__ == '__main__':
|
||||
'POSTGRES_IMAGE': args.postgres,
|
||||
'SEARCH_IMAGE': args.search,
|
||||
'SEARCH_LOG_LEVEL': args.searchLogLevel,
|
||||
'ENABLE_CROSS_LOCALE': args.enableCrossLocale,
|
||||
'SEARCH_ENABLE_SPELLCHECK': str(args.spellcheck).lower(),
|
||||
'DISABLE_CASCADE_TRACKING': str(args.disableCascadeTracking).lower()
|
||||
}
|
||||
|
@@ -29,4 +29,11 @@ RUN if [ "${SEARCH_LOG_LEVEL}" != "" ] ; then \
|
||||
$${DIST_DIR}/solr/bin/search_config_setup.sh; \
|
||||
fi
|
||||
|
||||
# Enable cross locale configuration if requested.
|
||||
RUN if [[ "${ENABLE_CROSS_LOCALE}" == "True" ]] ; then \
|
||||
sed -i '/^bash.*/i sed -i "'"/alfresco.cross.locale.datatype/s/^#//g"'" $${DIST_DIR}/solrhome/conf/shared.properties\n' \
|
||||
$${DIST_DIR}/solr/bin/search_config_setup.sh; \
|
||||
fi
|
||||
|
||||
|
||||
VOLUME ["/opt/alfresco-search-services/keystore"]
|
||||
|
36
e2e-test/src/main/resources/model/tokenised-model.xml
Normal file
36
e2e-test/src/main/resources/model/tokenised-model.xml
Normal file
@@ -0,0 +1,36 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<model xmlns="http://www.alfresco.org/model/dictionary/1.0" name="tok:tok">
|
||||
<imports>
|
||||
<import uri="http://www.alfresco.org/model/content/1.0" prefix="cm"/>
|
||||
<import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d"/>
|
||||
</imports>
|
||||
<namespaces>
|
||||
<namespace uri="http://www.alfresco.org/model/tokenised/1.0" prefix="tok"/>
|
||||
</namespaces>
|
||||
<types>
|
||||
<type name="tok:document">
|
||||
<parent>cm:content</parent>
|
||||
<properties>
|
||||
<property name="tok:true">
|
||||
<type>d:text</type>
|
||||
<index enabled="true">
|
||||
<tokenised>TRUE</tokenised>
|
||||
</index>
|
||||
</property>
|
||||
<property name="tok:false">
|
||||
<type>d:text</type>
|
||||
<index enabled="true">
|
||||
<tokenised>FALSE</tokenised>
|
||||
</index>
|
||||
</property>
|
||||
<property name="tok:both">
|
||||
<type>d:text</type>
|
||||
<index enabled="true">
|
||||
<tokenised>BOTH</tokenised>
|
||||
</index>
|
||||
</property>
|
||||
</properties>
|
||||
</type>
|
||||
</types>
|
||||
<aspects/>
|
||||
</model>
|
@@ -0,0 +1,176 @@
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Search Services E2E Test
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2021 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
* #L%
|
||||
*/
|
||||
package org.alfresco.test.search.functional;
|
||||
|
||||
import static com.google.common.collect.ImmutableMap.of;
|
||||
import static java.util.Arrays.asList;
|
||||
import static java.util.stream.IntStream.range;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.alfresco.rest.search.SearchResponse;
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
import org.alfresco.utility.data.DataContent;
|
||||
import org.alfresco.utility.data.DataSite;
|
||||
import org.alfresco.utility.model.FileModel;
|
||||
import org.alfresco.utility.model.FileType;
|
||||
import org.alfresco.utility.model.FolderModel;
|
||||
import org.apache.chemistry.opencmis.commons.PropertyIds;
|
||||
import org.apache.chemistry.opencmis.commons.enums.VersioningState;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
|
||||
/**
|
||||
* Base corpus for Exact Term tests.
|
||||
* SearchExactTerm tests, with and without cross locale configuration, are using this corpus
|
||||
* so results can be compared.
|
||||
*/
|
||||
public abstract class AbstractSearchExactTermTest extends AbstractE2EFunctionalTest
|
||||
{
|
||||
@Autowired
|
||||
protected DataSite dataSite;
|
||||
|
||||
@Autowired
|
||||
protected DataContent dataContent;
|
||||
|
||||
private static final DateFormat QUERY_DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd");
|
||||
protected String fromDate;
|
||||
protected String toDate;
|
||||
|
||||
private void prepareExactSearchData(FolderModel testFolder) throws Exception {
|
||||
|
||||
List<Map<String, String>> exactSearchData = asList(
|
||||
// Document #1
|
||||
of("name", "Running",
|
||||
"description", "Running is a sport is a nice activity",
|
||||
"content", "when you are running you are doing an amazing sport",
|
||||
"title", "Running jumping"),
|
||||
// Document #2
|
||||
of("name", "Run",
|
||||
"description", "you are supposed to run jump",
|
||||
"content", "after many runs you are tired and if you jump it happens the same",
|
||||
"title", "Run : a philosophy"),
|
||||
// Document #3
|
||||
of("name", "Poetry",
|
||||
"description", "a document about poetry and jumpers",
|
||||
"content", "poetry is unrelated to sport",
|
||||
"title", "Running jumping twice jumpers"),
|
||||
// Document #4
|
||||
of("name", "Jump",
|
||||
"description", "a document about jumps",
|
||||
"content", "runnings jumpings",
|
||||
"title", "Running"),
|
||||
// Document #5
|
||||
of("name", "Running jumping",
|
||||
"description", "runners jumpers runs everywhere",
|
||||
"content", "run is Good as jump",
|
||||
"title", "Running the art of jumping"));
|
||||
|
||||
// tok:true, tok:false and tok:both have a copy of the value in cm:title field
|
||||
|
||||
List<FileModel> createdFileModels = new ArrayList<>();
|
||||
range(0, exactSearchData.size())
|
||||
.forEach(id -> {
|
||||
|
||||
Map<String, String> record = exactSearchData.get(id);
|
||||
|
||||
Map<String, Object> properties = new HashMap<>();
|
||||
properties.put(PropertyIds.OBJECT_TYPE_ID, "D:tok:document");
|
||||
properties.put(PropertyIds.NAME, record.get("name"));
|
||||
properties.put("cm:title", record.get("title"));
|
||||
properties.put("cm:description", record.get("description"));
|
||||
properties.put("tok:true", record.get("title"));
|
||||
properties.put("tok:false", record.get("title"));
|
||||
properties.put("tok:both", record.get("title"));
|
||||
properties.put(PropertyIds.SECONDARY_OBJECT_TYPE_IDS, List.of("P:cm:titled"));
|
||||
|
||||
FileModel fileModel = FileModel.getRandomFileModel(FileType.TEXT_PLAIN, record.get("content"));
|
||||
fileModel.setName(record.get("name"));
|
||||
|
||||
cmisApi.authenticateUser(testUser).usingSite(testSite).usingResource(testFolder)
|
||||
.createFile(fileModel, properties, VersioningState.MAJOR)
|
||||
.assertThat().existsInRepo();
|
||||
|
||||
createdFileModels.add(fileModel);
|
||||
|
||||
});
|
||||
|
||||
waitForContentIndexing(createdFileModels.get(createdFileModels.size() - 1).getName(), true);
|
||||
|
||||
}
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
serverHealth.assertServerIsOnline();
|
||||
|
||||
deployCustomModel("model/tokenised-model.xml");
|
||||
|
||||
dataUser.addUserToSite(testUser, testSite, UserRole.SiteContributor);
|
||||
|
||||
FolderModel testFolder = dataContent.usingSite(testSite).usingUser(testUser).createFolder();
|
||||
prepareExactSearchData(testFolder);
|
||||
|
||||
// Calculate time query range, required for conjunction queries
|
||||
Date today = new Date();
|
||||
|
||||
LocalDateTime yesterday = today.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
|
||||
yesterday = yesterday.plusDays(-1);
|
||||
fromDate = QUERY_DATE_FORMAT.format(Date.from(yesterday.atZone(ZoneId.systemDefault()).toInstant()));
|
||||
|
||||
LocalDateTime tomorrow = today.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
|
||||
tomorrow = tomorrow.plusDays(1);
|
||||
toDate = QUERY_DATE_FORMAT.format(Date.from(tomorrow.atZone(ZoneId.systemDefault()).toInstant()));
|
||||
|
||||
}
|
||||
|
||||
protected void assertResponseCardinality(String query, int num)
|
||||
{
|
||||
SearchResponse response = queryAsUser(testUser, query);
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
Assert.assertEquals(response.getPagination().getCount(), num, query);
|
||||
}
|
||||
|
||||
protected void assertException(String query)
|
||||
{
|
||||
queryAsUser(testUser, query);
|
||||
Assert.assertTrue(
|
||||
restClient.getStatusCode().equals(String.valueOf(HttpStatus.NOT_IMPLEMENTED)) ||
|
||||
restClient.getStatusCode().equals(String.valueOf(HttpStatus.INTERNAL_SERVER_ERROR)),
|
||||
"Status code is not as expected.");
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,345 @@
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Search Services E2E Test
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2021 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
* #L%
|
||||
*/
|
||||
package org.alfresco.test.search.functional.searchServices.search;
|
||||
|
||||
import org.alfresco.test.search.functional.AbstractSearchExactTermTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
* Tests including all different tokenization (false, true, both) modes with Exact Term queries.
|
||||
* Since Search Services are not configured with Cross Locale enabled, some errors and omissions are expected.
|
||||
* These tests are based in AFTSDefaultTextQueryIT class, but an additional type of property
|
||||
* has been added (tok:true) in order to provide full coverage for the available options.
|
||||
*
|
||||
* Since tok:true and tok:both properties are not supported to be used with exact term search,
|
||||
* exception from this queries is expected.
|
||||
*
|
||||
* SOLR log is dumping the cause of the error, for instance:
|
||||
* java.lang.UnsupportedOperationException: Exact Term search is not supported unless you configure the field
|
||||
* <{http://www.alfresco.org/model/tokenised/1.0}true> for cross locale search
|
||||
*
|
||||
* Note that tests not specifying a searching field in the query (for instance, =run) are using
|
||||
* by default following properties: cm:name, cm:title, cm:description, cm:content
|
||||
* Since cm:name is the only one declared as Cross Locale by default in shared.properties,
|
||||
* these kind of queries are being executed only for cm:name property.
|
||||
*/
|
||||
public class SearchExactTermTest extends AbstractSearchExactTermTest
|
||||
{
|
||||
|
||||
@Test
|
||||
public void exactSearch_singleTerm_shouldReturnResultsContainingExactTermInName() throws Exception
|
||||
{
|
||||
/*
|
||||
* 1 result is expected:
|
||||
* - Document #2 >> name: "Run"
|
||||
*/
|
||||
assertResponseCardinality("=run", 1);
|
||||
|
||||
/*
|
||||
* No result for runner in cm:name property, one record has runners in "description" property.
|
||||
* You can see the difference between exact search and not
|
||||
*/
|
||||
assertResponseCardinality("=runner", 0);
|
||||
assertResponseCardinality("runner", 1);
|
||||
|
||||
/*
|
||||
* 1 result is expected:
|
||||
* - Document #2 >> name: "Jump"
|
||||
*/
|
||||
assertResponseCardinality("=jump", 1);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void exactSearch_singleTermConjunction_shouldReturnFullFieldValueMatch() throws Exception
|
||||
{
|
||||
|
||||
/**
|
||||
* Since REST API is getting the results from DB or Search Services, using single term expressions is always
|
||||
* retrieved from DB when using default configuration "solr.query.fts.queryConsistency=TRANSACTIONAL_IF_POSSIBLE".
|
||||
* Combining this single term with range queries (like cm:created) will ensure the results
|
||||
* are coming from SOLR in this mode.
|
||||
*/
|
||||
|
||||
/*
|
||||
* 1 result is expected for non-tokenised field (tok:false)
|
||||
* - Document #4 >> title: "Running"
|
||||
*/
|
||||
assertResponseCardinality("=tok:false:Running AND cm:created:['" + fromDate + "' TO '" + toDate + "']", 1);
|
||||
|
||||
/*
|
||||
* 0 results are expected: there is no result that have exactly cm:title:"Run"
|
||||
* The closest we have is record Run (tok:false:"Run : a philosophy")
|
||||
* As you can see we don't have a full match, so it's not in the results.
|
||||
*
|
||||
*/
|
||||
assertResponseCardinality("=tok:false:Run AND cm:created:['" + fromDate + "' TO '" + toDate + "']", 0);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* These tests should be re-enabled once the following tickets have been solved:
|
||||
* - https://alfresco.atlassian.net/browse/SEARCH-2461
|
||||
* - https://alfresco.atlassian.net/browse/SEARCH-2953
|
||||
*/
|
||||
@Test(enabled=false)
|
||||
public void failing_exactSearch_singleTermConjunction_shouldReturnFullFieldValueMatch() throws Exception
|
||||
{
|
||||
|
||||
// SEARCH-2953
|
||||
assertResponseCardinality("=tok:false:running AND cm:created:['" + fromDate + "' TO '" + toDate + "']", 1);
|
||||
|
||||
// SEARCH-2461
|
||||
assertResponseCardinality("=tok:false:running", 1);
|
||||
|
||||
// SEARCH-2461
|
||||
assertResponseCardinality("=tok:false:Running", 1);
|
||||
|
||||
// SEARCH-2461
|
||||
assertResponseCardinality("=tok:false:Run", 0);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void exactSearch_singleTermConjunction_shouldReturnException() throws Exception
|
||||
{
|
||||
|
||||
/**
|
||||
* Since REST API is getting the results from DB or Search Services, using single term expressions is always
|
||||
* retrieved from DB when using default configuration "solr.query.fts.queryConsistency=TRANSACTIONAL_IF_POSSIBLE".
|
||||
* Combining this single term with range queries (like cm:created) will ensure the results
|
||||
* are coming from SOLR in this mode.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Unsupported Exception is expected when using exact term search with tokenised properties
|
||||
*/
|
||||
assertException("=tok:true:running AND cm:created:['" + fromDate + "' TO '" + toDate + "']");
|
||||
assertException("=tok:both:running AND cm:created:['" + fromDate + "' TO '" + toDate + "']");
|
||||
|
||||
/**
|
||||
* Unsupported Exception is expected when using exact term search with tokenised properties
|
||||
*/
|
||||
assertException("=tok:true:Running AND cm:created:['" + fromDate + "' TO '" + toDate + "']");
|
||||
assertException("=tok:both:Running AND cm:created:['" + fromDate + "' TO '" + toDate + "']");
|
||||
|
||||
/**
|
||||
* Unsupported Exception is expected when using exact term search with tokenised properties
|
||||
*/
|
||||
assertException("=tok:true:Run AND cm:created:['" + fromDate + "' TO '" + toDate + "']");
|
||||
assertException("=tok:both:Run AND cm:created:['" + fromDate + "' TO '" + toDate + "']");
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* These tests should be re-enabled once the following tickets have been solved:
|
||||
* - https://alfresco.atlassian.net/browse/SEARCH-2461
|
||||
*/
|
||||
@Test(enabled=false)
|
||||
public void failing_exactSearch_singleTermConjunction_shouldReturnException() throws Exception
|
||||
{
|
||||
|
||||
// SEARCH-2461
|
||||
assertException("=tok:true:running");
|
||||
assertException("=tok:both:running");
|
||||
|
||||
// SEARCH-2461
|
||||
assertException("=tok:true:Running");
|
||||
assertException("=tok:both:Running");
|
||||
|
||||
// SEARCH-2461
|
||||
assertException("=tok:true:Run");
|
||||
assertException("=tok:both:Run");
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void exactSearch_multiTerm_shouldReturnResultsContainingExactTerm() throws Exception
|
||||
{
|
||||
/*
|
||||
* 2 results are expected:
|
||||
* - Document #2 >> name: "Run"
|
||||
* - Document #4 >> name: "Jump"
|
||||
*/
|
||||
assertResponseCardinality("=run =jump", 2);
|
||||
|
||||
/*
|
||||
* No result for runner or jumper in cm:name property
|
||||
* One document has runners and another record has jumpers in description
|
||||
* You can see the difference between exact search and not
|
||||
*/
|
||||
assertResponseCardinality("=runner =jumper", 0);
|
||||
assertResponseCardinality("runner jumper", 2);
|
||||
|
||||
/*
|
||||
* 2 results are expected:
|
||||
* - Document #1 >> name: "Running"
|
||||
* - Document #5 >> name: "Running jumping"
|
||||
*/
|
||||
assertResponseCardinality("=running =jumping", 2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void exactSearch_multiTermInFieldWithOnlyUnTokenizedAnalysis_shouldReturnFullFieldValueMatch() throws Exception
|
||||
{
|
||||
|
||||
/*
|
||||
* 1 result is expected
|
||||
* - Document #4 >> title: "Running"
|
||||
*/
|
||||
assertResponseCardinality("=tok:false:Running =tok:false:jumpers AND cm:created:['" + fromDate + "' TO '" + toDate + "']", 1);
|
||||
|
||||
/**
|
||||
* Unsupported Exception is expected when using exact term search with tokenised properties
|
||||
*/
|
||||
assertException("=tok:both:running =tok:both:jumpers AND cm:created:['" + fromDate + "' TO '" + toDate + "']");
|
||||
assertException("=tok:true:running =tok:true:jumpers AND cm:created:['" + fromDate + "' TO '" + toDate + "']");
|
||||
}
|
||||
|
||||
/**
|
||||
* These tests should be re-enabled once the following tickets have been solved:
|
||||
* - https://alfresco.atlassian.net/browse/SEARCH-2461
|
||||
* - https://alfresco.atlassian.net/browse/SEARCH-2953
|
||||
*/
|
||||
@Test(enabled=false)
|
||||
public void failing_exactSearch_multiTermInFieldWithOnlyUnTokenizedAnalysis_shouldReturnFullFieldValueMatch() throws Exception
|
||||
{
|
||||
// SEARCH-2953
|
||||
assertResponseCardinality("=tok:false:running =tok:false:jumpers AND cm:created:['" + fromDate + "' TO '" + toDate + "']", 1);
|
||||
|
||||
// SEARCH-2461
|
||||
assertResponseCardinality("=tok:false:running =tok:false:jumpers", 1);
|
||||
assertException("=tok:both:running =tok:both:jumpers");
|
||||
assertException("=tok:true:running =tok:true:jumpers");
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void exactSearch_exactPhrase_shouldReturnResultsContainingExactPhrase() throws Exception
|
||||
{
|
||||
/*
|
||||
* No result for "run jump" in cm:name property
|
||||
*/
|
||||
assertResponseCardinality("=\"run jump\"", 0);
|
||||
|
||||
/*
|
||||
* No result for "runner jumper" in cm:name property
|
||||
* One document has runners jumpers in description
|
||||
* You can see the difference between exact search and not
|
||||
*/
|
||||
assertResponseCardinality("=\"runner jumper\"", 0);
|
||||
assertResponseCardinality("\"runner jumper\"", 1);
|
||||
|
||||
/*
|
||||
* 1 result is expected for exact term search
|
||||
* - Document #5 >> name: "Running jumping"
|
||||
*/
|
||||
assertResponseCardinality("=\"running jumping\"", 1);
|
||||
|
||||
/*
|
||||
* 5 results are expected for not exact term search:
|
||||
* - Document #1 >> name: "Running", description: "Running is a sport is a nice activity", content: "when you are running you are doing an amazing sport", title: "Running jumping"
|
||||
* - Document #2 >> name: "Run", description: "you are supposed to run jump", content: "after many runs you are tired and if you jump it happens the same", title: "Run : a philosophy"
|
||||
* - Document #3 >> title: "Running jumping twice jumpers"
|
||||
* - Document #4 >> content: "runnings jumpings", title: "Running"
|
||||
* - Document #5 >> name: "Running jumping", title: "Running the art of jumping"
|
||||
*/
|
||||
assertResponseCardinality("\"running jumping\"", 5);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void exactSearch_phraseInFieldConjunction_shouldReturnFullFieldValueMatch() throws Exception
|
||||
{
|
||||
/*
|
||||
* 1 result is expected for exact term search
|
||||
* - Document #5 >> name: "Running jumping"
|
||||
*/
|
||||
assertResponseCardinality("=tok:false:\"Running jumping\" AND cm:created:['" + fromDate + "' TO '" + toDate + "']", 1);
|
||||
|
||||
/*
|
||||
* No result for "Running jumping twice" in cm:name property is expected
|
||||
*/
|
||||
assertResponseCardinality("=tok:false:\"Running jumping twice\" AND cm:created:['" + fromDate + "' TO '" + toDate + "']", 0);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* These tests should be re-enabled once the following tickets have been solved:
|
||||
* - https://alfresco.atlassian.net/browse/SEARCH-2461
|
||||
* - https://alfresco.atlassian.net/browse/SEARCH-2953
|
||||
*/
|
||||
@Test(enabled=false)
|
||||
public void failing_exactSearch_phraseInFieldConjunction_shouldReturnFullFieldValueMatch() throws Exception
|
||||
{
|
||||
|
||||
// SEARCH-2953
|
||||
assertResponseCardinality("=tok:false:\"running jumping\" AND cm:created:['" + fromDate + "' TO '" + toDate + "']", 1);
|
||||
|
||||
// SEARCH-2461
|
||||
assertResponseCardinality("=tok:false:\"running jumping\"", 1);
|
||||
assertResponseCardinality("=tok:false:\"Running jumping\"", 1);
|
||||
|
||||
// SEARCH-2461
|
||||
assertResponseCardinality("=tok:false:\"Running jumping twice\"", 0);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void exactSearch_phraseInFieldConjunction_shouldReturnOrException() throws Exception
|
||||
{
|
||||
/**
|
||||
* Unsupported Exception is expected when using exact term search with tokenised properties
|
||||
*/
|
||||
assertException("=tok:true:\"running jumping\" AND cm:created:['" + fromDate + "' TO '" + toDate + "']");
|
||||
assertException("=tok:both:\"running jumping\" AND cm:created:['" + fromDate + "' TO '" + toDate + "']");
|
||||
|
||||
/**
|
||||
* Unsupported Exception is expected when using exact term search with tokenised properties
|
||||
*/
|
||||
assertException("=tok:true:\"Running jumping twice\" AND cm:created:['" + fromDate + "' TO '" + toDate + "']");
|
||||
assertException("=tok:both:\"Running jumping twice\" AND cm:created:['" + fromDate + "' TO '" + toDate + "']");
|
||||
}
|
||||
|
||||
/**
|
||||
* These tests should be re-enabled once the following tickets have been solved:
|
||||
* - https://alfresco.atlassian.net/browse/SEARCH-2461
|
||||
*/
|
||||
@Test(enabled=false)
|
||||
public void failing_exactSearch_phraseInFieldConjunction_shouldReturnException() throws Exception
|
||||
{
|
||||
|
||||
// SEARCH-2461
|
||||
assertException("=tok:true:\"Running jumping\"");
|
||||
assertException("=tok:both:\"Running jumping\"");
|
||||
|
||||
// SEARCH-2461
|
||||
assertException("=tok:true:\"Running jumping twice\"");
|
||||
assertException("=tok:both:\"Running jumping twice\"");
|
||||
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,386 @@
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Search Services E2E Test
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2021 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
* #L%
|
||||
*/
|
||||
|
||||
package org.alfresco.test.search.functional.searchServices.search.crosslocale;
|
||||
|
||||
import org.alfresco.test.search.functional.AbstractSearchExactTermTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
|
||||
/**
|
||||
* Tests including all different tokenization (false, true, both) modes with Exact Term queries.
|
||||
* Search Services must be configured with Cross Locale enabled in order to run these tests.
|
||||
* These tests are based in AFTSDefaultTextQueryIT class, but an additional type of property
|
||||
* has been added (tok:true) in order to provide full coverage for the available options.
|
||||
*/
|
||||
public class SearchExactTermCrossLocaleTest extends AbstractSearchExactTermTest
|
||||
{
|
||||
|
||||
/**
|
||||
* Note these tests are searching in cm:name, cm:title, cm:description and cm:content properties
|
||||
*/
|
||||
@Test
|
||||
public void exactSearch_singleTerm_shouldReturnResultsContainingExactTerm() throws Exception
|
||||
{
|
||||
/*
|
||||
* 2 results are expected:
|
||||
* - Document #2 >> name: "Run", description: "you are supposed to run jump", title: "Run : a philosophy"
|
||||
* - Document #5 >> content: "run is Good as jump"
|
||||
*/
|
||||
assertResponseCardinality("=run", 2);
|
||||
|
||||
/*
|
||||
* No result for runner, Document #5 has "runners" in description,
|
||||
* you can see the difference between exact search and not
|
||||
*/
|
||||
assertResponseCardinality("=runner", 0);
|
||||
assertResponseCardinality("runner", 1);
|
||||
|
||||
/*
|
||||
* 3 results are expected:
|
||||
* - Document #2 >> description: "you are supposed to run jump", content: "after many runs you are tired and if you jump it happens the same"
|
||||
* - Document #4 >> name: "Jump"
|
||||
* - Document #5 >> content: "run is Good as jump"
|
||||
*/
|
||||
assertResponseCardinality("=jump", 3);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void exactSearch_singleTermConjunction_shouldReturnFullFieldValueMatch() throws Exception
|
||||
{
|
||||
|
||||
/**
|
||||
* Since REST API is getting the results from DB or Search Services, using single term expressions is always
|
||||
* retrieved from DB when using default configuration "solr.query.fts.queryConsistency=TRANSACTIONAL_IF_POSSIBLE".
|
||||
* Combining this single term with range queries (like cm:created) will ensure the results
|
||||
* are coming from SOLR in this mode.
|
||||
*/
|
||||
|
||||
/*
|
||||
* 1 result is expected for non-tokenised field (tok:false)
|
||||
* - Document #4 >> title: "Running"
|
||||
*/
|
||||
assertResponseCardinality("=tok:false:Running AND cm:created:['" + fromDate + "' TO '" + toDate + "']", 1);
|
||||
|
||||
/*
|
||||
* 0 results are expected for non-tokenised field (tok:false), as there is no title: "Run"
|
||||
*/
|
||||
assertResponseCardinality("=tok:false:Run AND cm:created:['" + fromDate + "' TO '" + toDate + "']", 0);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* These tests should be re-enabled once the following tickets have been solved:
|
||||
* - https://alfresco.atlassian.net/browse/SEARCH-2461
|
||||
* - https://alfresco.atlassian.net/browse/SEARCH-2953
|
||||
*/
|
||||
@Test(enabled=false)
|
||||
public void failing_exactSearch_singleTerm_shouldReturnFullFieldValueMatch() throws Exception
|
||||
{
|
||||
|
||||
// SEARCH-2953
|
||||
assertResponseCardinality("=tok:false:running AND cm:created:['" + fromDate + "' TO '" + toDate + "']", 1);
|
||||
|
||||
// SEARCH-2461
|
||||
assertResponseCardinality("=tok:false:running", 1);
|
||||
|
||||
// SEARCH-2461
|
||||
assertResponseCardinality("=tok:false:Running", 1);
|
||||
|
||||
// SEARCH-2461
|
||||
assertResponseCardinality("=tok:false:Run", 0);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void exactSearch_singleTermConjunction_shouldReturnPartialFieldValueMatch() throws Exception
|
||||
{
|
||||
|
||||
/**
|
||||
* Since REST API is getting the results from DB or Search Services, using single term expressions is always
|
||||
* retrieved from DB when using default configuration "solr.query.fts.queryConsistency=TRANSACTIONAL_IF_POSSIBLE".
|
||||
* Combining this single term with range queries (like cm:created) will ensure the results
|
||||
* are coming from SOLR in this mode.
|
||||
*/
|
||||
|
||||
/*
|
||||
* 4 results are expected for tokenised fields (tok:true, tok:both)
|
||||
* - Document #1 >> title: "Running jumping"
|
||||
* - Document #3 >> title: "Running jumping twice jumpers"
|
||||
* - Document #4 >> title: "Running"
|
||||
* - Document #5 >> title: "Running the art of jumping"
|
||||
*/
|
||||
assertResponseCardinality("=tok:true:running AND cm:created:['" + fromDate + "' TO '" + toDate + "']", 4);
|
||||
assertResponseCardinality("=tok:both:running AND cm:created:['" + fromDate + "' TO '" + toDate + "']", 4);
|
||||
|
||||
/**
|
||||
* 4 results are expected for tokenised fields (tok:true, tok:both)
|
||||
* - Document #1 >> title: "Running jumping"
|
||||
* - Document #3 >> title: "Running jumping twice jumpers"
|
||||
* - Document #4 >> title: "Running"
|
||||
* - Document #5 >> title: "Running the art of jumping"
|
||||
*/
|
||||
assertResponseCardinality("=tok:true:Running AND cm:created:['" + fromDate + "' TO '" + toDate + "']", 4);
|
||||
assertResponseCardinality("=tok:both:Running AND cm:created:['" + fromDate + "' TO '" + toDate + "']", 4);
|
||||
|
||||
/**
|
||||
* 1 result is expected for tokenised fields (tok:true, tok:both)
|
||||
* - Document #2 >> title: "Run : a philosophy"
|
||||
*/
|
||||
assertResponseCardinality("=tok:true:Run AND cm:created:['" + fromDate + "' TO '" + toDate + "']", 1);
|
||||
assertResponseCardinality("=tok:both:Run AND cm:created:['" + fromDate + "' TO '" + toDate + "']", 1);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* These tests should be re-enabled once the following tickets have been solved:
|
||||
* - https://alfresco.atlassian.net/browse/SEARCH-2461
|
||||
*/
|
||||
@Test(enabled=false)
|
||||
public void failing_exactSearch_singleTerm_shouldReturnPartialFieldValueMatch() throws Exception
|
||||
{
|
||||
|
||||
// SEARCH-2461
|
||||
assertResponseCardinality("=tok:true:running", 4);
|
||||
assertResponseCardinality("=tok:both:running", 4);
|
||||
|
||||
// SEARCH-2461
|
||||
assertResponseCardinality("=tok:true:Running", 4);
|
||||
assertResponseCardinality("=tok:both:Running", 4);
|
||||
|
||||
// SEARCH-2461
|
||||
assertResponseCardinality("=tok:true:Run", 1);
|
||||
assertResponseCardinality("=tok:both:Run", 1);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Note these tests are searching in cm:name, cm:title, cm:description and cm:content properties
|
||||
*/
|
||||
@Test
|
||||
public void exactSearch_multiTerm_shouldReturnResultsContainingExactTerm() throws Exception
|
||||
{
|
||||
/*
|
||||
* 3 results are expected:
|
||||
* - Document #2 >> name: "Run", description: "you are supposed to run jump", title: "Run : a philosophy", content: "after many runs you are tired and if you jump it happens the same"
|
||||
* - Document #4 >> name: "Jump"
|
||||
* - Document #5 >> content: "run is Good as jump"
|
||||
*/
|
||||
assertResponseCardinality("=run =jump", 3);
|
||||
|
||||
/*
|
||||
* No result for runner or jumper
|
||||
* Document #3 has "jumpers" in description and title
|
||||
* Document #5 has "runners" and "jumpers" in description
|
||||
* You can see the difference between exact search and not
|
||||
*/
|
||||
assertResponseCardinality("=runner =jumper", 0);
|
||||
assertResponseCardinality("runner jumper", 2);
|
||||
|
||||
/*
|
||||
* 5 results are expected:
|
||||
* - Document #1 >> name: "Running", description: "Running is a sport is a nice activity", content: "when you are running you are doing an amazing sport", title: "Running jumping"
|
||||
* - Document #2 >> name: "Run", description: "you are supposed to run jump", content: "after many runs you are tired and if you jump it happens the same", title: "Run : a philosophy"
|
||||
* - Document #3 >> title: "Running jumping twice jumpers"
|
||||
* - Document #4 >> content: "runnings jumpings", title: "Running"
|
||||
* - Document #5 >> name: "Running jumping", title: "Running the art of jumping"
|
||||
*/
|
||||
assertResponseCardinality("=running =jumping", 5);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void exactSearch_multiTermInField_shouldReturnPartialFieldValueMatch() throws Exception
|
||||
{
|
||||
/**
|
||||
* 4 results are expected for tokenised fields (tok:true, tok:both)
|
||||
* - Document #1 >> title: "Running jumping"
|
||||
* - Document #3 >> title: "Running jumping twice jumpers"
|
||||
* - Document #4 >> title: "Running"
|
||||
* - Document #5 >> title: "Running the art of jumping"
|
||||
*/
|
||||
assertResponseCardinality("=tok:both:running =tok:both:jumpers AND cm:created:['" + fromDate + "' TO '" + toDate + "']", 4);
|
||||
assertResponseCardinality("=tok:true:running =tok:true:jumpers AND cm:created:['" + fromDate + "' TO '" + toDate + "']", 4);
|
||||
}
|
||||
|
||||
/**
|
||||
* These tests should be re-enabled once the following tickets have been solved:
|
||||
* - https://alfresco.atlassian.net/browse/SEARCH-2461
|
||||
*/
|
||||
@Test(enabled=false)
|
||||
public void failing_exactSearch_multiTermInField_shouldReturnPartialFieldValueMatch() throws Exception
|
||||
{
|
||||
|
||||
// SEARCH-2461
|
||||
assertResponseCardinality("=tok:both:running =tok:both:jumpers", 4);
|
||||
assertResponseCardinality("=tok:true:running =tok:true:jumpers", 4);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* These tests should be re-enabled once the following tickets have been solved:
|
||||
* - https://alfresco.atlassian.net/browse/SEARCH-2461
|
||||
* - https://alfresco.atlassian.net/browse/SEARCH-2953
|
||||
*/
|
||||
@Test(enabled=false)
|
||||
public void failing_exactSearch_multiTermInField_shouldReturnFullFieldValueMatch() throws Exception
|
||||
{
|
||||
|
||||
// SEARCH-2953
|
||||
assertResponseCardinality("=tok:false:running =tok:false:jumpers AND cm:created:['" + fromDate + "' TO '" + toDate + "']", 1);
|
||||
|
||||
// SEARCH-2461
|
||||
assertResponseCardinality("=tok:false:running =tok:false:jumpers", 0);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Note these tests are searching in cm:name, cm:title, cm:description and cm:content properties
|
||||
*/
|
||||
@Test
|
||||
public void exactSearch_exactPhrase_shouldReturnResultsContainingExactPhrase() throws Exception
|
||||
{
|
||||
/*
|
||||
* 1 results are expected:
|
||||
* - Document #2 >> description: "you are supposed to run jump"
|
||||
*/
|
||||
assertResponseCardinality("=\"run jump\"", 1);
|
||||
|
||||
/*
|
||||
* No result for "runner jumper" using exact term search
|
||||
* Document #5 has "runners" and "jumpers" in description, so it should be a result for not exact term search
|
||||
* You can see the difference between exact search and not
|
||||
*/
|
||||
assertResponseCardinality("=\"runner jumper\"", 0);
|
||||
assertResponseCardinality("\"runner jumper\"", 1);
|
||||
|
||||
/*
|
||||
* 3 results are expected for exact term search:
|
||||
* - Document #1 >> title: "Running jumping"
|
||||
* - Document #3 >> title: "Running jumping twice jumpers"
|
||||
* - Document #5 >> name: "Running jumping"
|
||||
*
|
||||
* When not using exact term search, 4 results are expected
|
||||
* Since 'Milestone' wiki page (coming from ootb content) is including "running" in the content,
|
||||
* we are checking for 5 results instead of 4
|
||||
*
|
||||
* You can see the difference between exact search and not
|
||||
*/
|
||||
assertResponseCardinality("=\"running jumping\"", 3);
|
||||
assertResponseCardinality("\"running jumping\"", 5);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void exactSearch_phraseInFieldConjunction_shouldReturnFullFieldValueMatch() throws Exception
|
||||
{
|
||||
/**
|
||||
* 1 results is expected for non-tokenised field (tok:false)
|
||||
* - Document #1 >> title: "Running jumping"
|
||||
*/
|
||||
assertResponseCardinality("=tok:false:\"Running jumping\" AND cm:created:['" + fromDate + "' TO '" + toDate + "']", 1);
|
||||
|
||||
/**
|
||||
* No result is expected for non-tokenised field (tok:false), as there is no title: "Running jumping twice"
|
||||
*/
|
||||
assertResponseCardinality("=tok:false:\"Running jumping twice\" AND cm:created:['" + fromDate + "' TO '" + toDate + "']", 0);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* These tests should be re-enabled once the following tickets have been solved:
|
||||
* - https://alfresco.atlassian.net/browse/SEARCH-2461
|
||||
* - https://alfresco.atlassian.net/browse/SEARCH-2953
|
||||
*/
|
||||
@Test(enabled=false)
|
||||
public void failing_exactSearch_phraseInFieldConjunction_shouldReturnFullFieldValueMatch() throws Exception
|
||||
{
|
||||
|
||||
// SEARCH-2953
|
||||
assertResponseCardinality("=tok:false:\"running jumping\" AND cm:created:['" + fromDate + "' TO '" + toDate + "']", 1);
|
||||
|
||||
// SEARCH-2461
|
||||
assertResponseCardinality("=tok:false:\"running jumping\"", 1);
|
||||
|
||||
// SEARCH-2461
|
||||
assertResponseCardinality("=tok:false:\"Running jumping\"", 1);
|
||||
|
||||
// SEARCH-2461
|
||||
assertResponseCardinality("=tok:false:\"Running jumping twice\"", 0);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void exactSearch_phraseInFieldConjunction_shouldReturnPartialFieldValueMatch() throws Exception
|
||||
{
|
||||
/**
|
||||
* 2 results are expected for tokenised fields (tok:true, tok:both)
|
||||
* - Document #1 >> title: "Running jumping"
|
||||
* - Document #3 >> title: "Running jumping twice jumpers"
|
||||
*/
|
||||
assertResponseCardinality("=tok:true:\"running jumping\" AND cm:created:['" + fromDate + "' TO '" + toDate + "']", 2);
|
||||
assertResponseCardinality("=tok:both:\"running jumping\" AND cm:created:['" + fromDate + "' TO '" + toDate + "']", 2);
|
||||
|
||||
/**
|
||||
* 2 results are expected for tokenised fields (tok:true, tok:both)
|
||||
* - Document #1 >> title: "Running jumping"
|
||||
* - Document #3 >> title: "Running jumping twice jumpers"
|
||||
*/
|
||||
assertResponseCardinality("=tok:true:\"Running jumping\" AND cm:created:['" + fromDate + "' TO '" + toDate + "']", 2);
|
||||
assertResponseCardinality("=tok:both:\"Running jumping\" AND cm:created:['" + fromDate + "' TO '" + toDate + "']", 2);
|
||||
|
||||
/**
|
||||
* 1 result is expected for tokenised fields (tok:true, tok:both)
|
||||
* - Document #3 >> title: "Running jumping twice jumpers"
|
||||
*/
|
||||
assertResponseCardinality("=tok:true:\"Running jumping twice\" AND cm:created:['" + fromDate + "' TO '" + toDate + "']", 1);
|
||||
assertResponseCardinality("=tok:both:\"Running jumping twice\" AND cm:created:['" + fromDate + "' TO '" + toDate + "']", 1);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* These tests should be re-enabled once the following tickets have been solved:
|
||||
* - https://alfresco.atlassian.net/browse/SEARCH-2461
|
||||
*/
|
||||
@Test(enabled=false)
|
||||
public void failing_exactSearch_phraseInFieldConjunction_shouldReturnPartialFieldValueMatch() throws Exception
|
||||
{
|
||||
|
||||
// SEARCH-2461
|
||||
assertResponseCardinality("=tok:true:\"running jumping\"", 2);
|
||||
assertResponseCardinality("=tok:both:\"running jumping\"", 2);
|
||||
|
||||
// SEARCH-2461
|
||||
assertResponseCardinality("=tok:true:\"Running jumping\"", 2);
|
||||
assertResponseCardinality("=tok:both:\"Running jumping\"", 2);
|
||||
|
||||
// SEARCH-2461
|
||||
assertResponseCardinality("=tok:true:\"Running jumping twice\"", 1);
|
||||
assertResponseCardinality("=tok:both:\"Running jumping twice\"", 1);
|
||||
|
||||
}
|
||||
|
||||
}
|
@@ -19,6 +19,7 @@
|
||||
<exclude name="org.alfresco.test.search.functional.searchServices.cmis"/>
|
||||
<exclude name="org.alfresco.test.search.functional.searchServices.search.rm"/>
|
||||
<exclude name="org.alfresco.test.search.functional.searchServices.search.fingerprint"/>
|
||||
<exclude name="org.alfresco.test.search.functional.searchServices.search.crosslocale"/>
|
||||
</package>
|
||||
</packages>
|
||||
<!-- Despite this class is included in Search Services package, needs to be excluded in order to be executed as the last one -->
|
||||
|
17
e2e-test/src/test/resources/SearchSuiteCrossLocale.xml
Normal file
17
e2e-test/src/test/resources/SearchSuiteCrossLocale.xml
Normal file
@@ -0,0 +1,17 @@
|
||||
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
|
||||
|
||||
<suite name="SearchSuite" verbose="6" preserve-order="true">
|
||||
|
||||
<listeners>
|
||||
<listener class-name="org.alfresco.utility.report.log.LogsListener"/>
|
||||
<listener class-name="org.alfresco.utility.report.HtmlReportListener"/>
|
||||
</listeners>
|
||||
|
||||
<!-- This tests require Cross Locale configuration for Search Services -->
|
||||
<test name="E2E-CrossLocaleSearchServices">
|
||||
<packages>
|
||||
<package name="org.alfresco.test.search.functional.searchServices.search.crosslocale"/>
|
||||
</packages>
|
||||
</test>
|
||||
|
||||
</suite>
|
@@ -36,7 +36,6 @@ import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.net.URLClassLoader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedList;
|
||||
@@ -63,7 +62,6 @@ import org.alfresco.repo.dictionary.DictionaryDAOImpl;
|
||||
import org.alfresco.repo.dictionary.Facetable;
|
||||
import org.alfresco.repo.dictionary.IndexTokenisationMode;
|
||||
import org.alfresco.repo.dictionary.M2Model;
|
||||
import org.alfresco.repo.dictionary.M2ModelDiff;
|
||||
import org.alfresco.repo.dictionary.NamespaceDAO;
|
||||
import org.alfresco.repo.i18n.StaticMessageLookup;
|
||||
import org.alfresco.repo.search.MLAnalysisMode;
|
||||
@@ -81,12 +79,10 @@ import org.alfresco.repo.search.impl.querymodel.impl.lucene.QueryBuilderContext;
|
||||
import org.alfresco.repo.tenant.SingleTServiceImpl;
|
||||
import org.alfresco.repo.tenant.TenantService;
|
||||
import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
|
||||
import org.alfresco.service.cmr.dictionary.DictionaryException;
|
||||
import org.alfresco.service.cmr.dictionary.ModelDefinition;
|
||||
import org.alfresco.service.cmr.dictionary.PropertyDefinition;
|
||||
import org.alfresco.service.cmr.repository.StoreRef;
|
||||
import org.alfresco.service.cmr.search.SearchParameters;
|
||||
import org.alfresco.service.namespace.NamespaceException;
|
||||
import org.alfresco.service.namespace.NamespaceService;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.solr.AlfrescoClientDataModelServicesFactory.DictionaryKey;
|
||||
@@ -867,8 +863,7 @@ public class AlfrescoSolrDataModel implements QueryConstants
|
||||
*/
|
||||
private void addExactSearchFields(PropertyDefinition propertyDefinition, IndexedField indexedField)
|
||||
{
|
||||
if ((propertyDefinition.getIndexTokenisationMode() == IndexTokenisationMode.FALSE)
|
||||
|| !(propertyDefinition.getIndexTokenisationMode() == IndexTokenisationMode.BOTH))
|
||||
if ((propertyDefinition.getIndexTokenisationMode() == IndexTokenisationMode.FALSE))
|
||||
{
|
||||
|
||||
indexedField.addField(getFieldForText(true, false, false, propertyDefinition), true, false);
|
||||
@@ -876,11 +871,16 @@ public class AlfrescoSolrDataModel implements QueryConstants
|
||||
}
|
||||
else
|
||||
{
|
||||
if(crossLocaleSearchDataTypes.contains(propertyDefinition.getDataType().getName()) || crossLocaleSearchProperties.contains(propertyDefinition.getName()))
|
||||
if (crossLocaleSearchDataTypes.contains(propertyDefinition.getDataType().getName())
|
||||
|| crossLocaleSearchProperties.contains(propertyDefinition.getName()))
|
||||
{
|
||||
indexedField.addField(getFieldForText(false, true, false, propertyDefinition), false, false);
|
||||
} else{
|
||||
throw new UnsupportedOperationException("Exact Term search is not supported unless you configure the field <"+propertyDefinition.getName()+"> for cross locale search");
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new UnsupportedOperationException(
|
||||
"Exact Term search is not supported unless you configure the field <"
|
||||
+ propertyDefinition.getName() + "> for cross locale search");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user