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] 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 +}