From 1ebdaea6a75f786fe88b774102980eb149a4d737 Mon Sep 17 00:00:00 2001 From: tiagosalvado10 <9038083+tiagosalvado10@users.noreply.github.com> Date: Tue, 2 Feb 2021 15:34:52 +0000 Subject: [PATCH 1/2] Merge pull request #1074 from Alfresco/fix/MNT-22045_minhash_update_1.4.x [MNT-22045] Prevents MINHASH field from being always added. Enabled related unit tests. (cherry picked from commit 0c5505249e81ed09f7dc3b063b2ff62088323894) --- .../functional/searchServices/search/FingerPrintTest.java | 6 +++--- .../main/java/org/alfresco/solr/SolrInformationServer.java | 6 ++++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/FingerPrintTest.java b/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/FingerPrintTest.java index 688563809..dd9a663b9 100644 --- a/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/FingerPrintTest.java +++ b/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/FingerPrintTest.java @@ -190,7 +190,7 @@ public class FingerPrintTest extends AbstractE2EFunctionalTest testSearchQueryUnordered(fingerprintQuery, expectedNames, SearchLanguage.AFTS); } - @Test(priority = 5, enabled = false) + @Test(priority = 5) @Bug(id = "SEARCH-2065") public void searchAfterVersionUpdate() { @@ -215,7 +215,7 @@ public class FingerPrintTest extends AbstractE2EFunctionalTest Assert.assertTrue(found, "Update File Not found in results for Fingerprint Query with updated content"); } - @Test(priority = 6, enabled = false) + @Test(priority = 6) @Bug(id = "SEARCH-2065") public void searchAfterVersionRevert() throws Exception { @@ -236,7 +236,7 @@ public class FingerPrintTest extends AbstractE2EFunctionalTest Assert.assertTrue(notFound, "File appears in the results for Fingerprint Query even after reverting content changes"); } - @Test(priority = 7, enabled = false) + @Test(priority = 7) @Bug(id = "SEARCH-2065") public void searchAfterVersionDelete() throws Exception { diff --git a/search-services/alfresco-search/src/main/java/org/alfresco/solr/SolrInformationServer.java b/search-services/alfresco-search/src/main/java/org/alfresco/solr/SolrInformationServer.java index cdfb2faeb..a97d7c509 100644 --- a/search-services/alfresco-search/src/main/java/org/alfresco/solr/SolrInformationServer.java +++ b/search-services/alfresco-search/src/main/java/org/alfresco/solr/SolrInformationServer.java @@ -2749,7 +2749,9 @@ public class SolrInformationServer implements InformationServer TokenStream ts = analyzer.tokenStream("dummy_field", textContent); CharTermAttribute termAttribute = ts.getAttribute(CharTermAttribute.class); ts.reset(); - while (ts.incrementToken()) { + doc.removeField(FINGERPRINT_FIELD); + while (ts.incrementToken()) + { StringBuilder tokenBuff = new StringBuilder(); char[] buff = termAttribute.buffer(); @@ -4102,4 +4104,4 @@ public class SolrInformationServer implements InformationServer return empty(); } } -} \ No newline at end of file +} From 424026258fe6a162b9f6c43b772826cdd111675d Mon Sep 17 00:00:00 2001 From: Tiago Salvado Date: Wed, 3 Feb 2021 00:06:06 +0000 Subject: [PATCH 2/2] [MNT-22045] Fixed the way response is obtained as string --- .../functional/searchServices/search/FingerPrintTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/FingerPrintTest.java b/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/FingerPrintTest.java index dd9a663b9..04d6952a0 100644 --- a/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/FingerPrintTest.java +++ b/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/FingerPrintTest.java @@ -221,7 +221,7 @@ public class FingerPrintTest extends AbstractE2EFunctionalTest { // Revert fileToBeUpdated to previous version restClient.authenticateUser(testUser).withCoreAPI().usingNode(fileToBeUpdated).revertVersion("1.0", "{}"); - String revertedContent = restClient.authenticateUser(testUser).withCoreAPI().usingNode(fileToBeUpdated).getVersionContent("1.2").toString(); + String revertedContent = restClient.authenticateUser(testUser).withCoreAPI().usingNode(fileToBeUpdated).getVersionContent("1.2").getResponse().asString(); Assert.assertEquals(revertedContent, fileOriginal.getContent(), "Reverted content does not match Original"); // Wair for the new version of the file to be indexed