Jeroen Hoffman pushed to branch release/4.2 at cms-community / 
hippo-site-toolkit


Commits:
1a4c4272 by Jasper Floor at 2018-02-27T16:19:00+01:00
HSTTWO-4248 don't filter out ' backport of HSTTWO-4213

- - - - -
02fc7454 by Jeroen Hoffman at 2018-03-06T15:37:26+01:00
HSTTWO-4248 Reintegrate branch 'feature/HSTTWO-4248' into release/4.2

- - - - -


2 changed files:

- content-beans/src/main/java/org/hippoecm/hst/util/SearchInputParsingUtils.java
- 
content-beans/src/test/java/org/hippoecm/hst/util/TestSearchInputParsingUtils.java


Changes:

=====================================
content-beans/src/main/java/org/hippoecm/hst/util/SearchInputParsingUtils.java
=====================================
--- 
a/content-beans/src/main/java/org/hippoecm/hst/util/SearchInputParsingUtils.java
+++ 
b/content-beans/src/main/java/org/hippoecm/hst/util/SearchInputParsingUtils.java
@@ -271,10 +271,7 @@ public final class SearchInputParsingUtils {
                     sb.append('\\');
                     sb.append(c);
                 } else if (c == '\'') {
-                    // the jackrabbit xpath builder breaks on \' (however it 
should be possible according spec)
-                    if (retainWordBoundaries) {
-                        sb.append(' ');
-                    } // else skip it to provide old behavior
+                    sb.append("''");
                 } else if (c == ' ') {
                     // next term. set allowWildCardInCurrentTerm again to 
allowSingleNonLeadingWildCardPerTerm
                     allowWildCardInCurrentTerm = 
allowSingleNonLeadingWildCardPerTerm;


=====================================
content-beans/src/test/java/org/hippoecm/hst/util/TestSearchInputParsingUtils.java
=====================================
--- 
a/content-beans/src/test/java/org/hippoecm/hst/util/TestSearchInputParsingUtils.java
+++ 
b/content-beans/src/test/java/org/hippoecm/hst/util/TestSearchInputParsingUtils.java
@@ -154,17 +154,17 @@ public class TestSearchInputParsingUtils {
 
     @Test
     public void testSearchInputParsingUtils_parse_retainWordBoundaries() 
throws Exception {
-        assertEquals("I me love Ben Jerrie s?", 
SearchInputParsingUtils.parse("I(me) love Ben&Jerrie's?", true, true));
-        assertEquals("I me love Ben Jerrie s", 
SearchInputParsingUtils.parse("I(me) love Ben&Jerrie's?", false, true));
-        assertEquals("Ime love BenJerries?", 
SearchInputParsingUtils.parse("I[me] love Ben&Jerrie's?", true, false));
-        assertEquals("Ime love BenJerries", 
SearchInputParsingUtils.parse("I[me] love Ben&Jerrie's?", false, false));
-        assertEquals("The quick \\\"brown\\\" fox can t jump 32.3 feet, 
right", SearchInputParsingUtils.parse("The quick (“brown”) fox can’t jump 32.3 
feet, right?\n", false, true));
-        assertEquals("The quick \\\"brown\\\" fox can t jump 32.3 feet, 
right?", SearchInputParsingUtils.parse("The quick (“brown”) fox can’t jump 32.3 
feet, right?\n", true, true));
+        assertEquals("I me love Ben Jerrie''s?", 
SearchInputParsingUtils.parse("I(me) love Ben&Jerrie's?", true, true));
+        assertEquals("I me love Ben Jerrie''s", 
SearchInputParsingUtils.parse("I(me) love Ben&Jerrie's?", false, true));
+        assertEquals("Ime love BenJerrie''s?", 
SearchInputParsingUtils.parse("I[me] love Ben&Jerrie's?", true, false));
+        assertEquals("Ime love BenJerrie''s", 
SearchInputParsingUtils.parse("I[me] love Ben&Jerrie's?", false, false));
+        assertEquals("The quick \\\"brown\\\" fox can''t jump 32.3 feet, 
right", SearchInputParsingUtils.parse("The quick (“brown”) fox can’t jump 32.3 
feet, right?\n", false, true));
+        assertEquals("The quick \\\"brown\\\" fox can''t jump 32.3 feet, 
right?", SearchInputParsingUtils.parse("The quick (“brown”) fox can’t jump 32.3 
feet, right?\n", true, true));
         assertEquals("The quick !brown*", SearchInputParsingUtils.parse("The 
quick! !brown*", true, true));
         assertEquals("The quick !brown", SearchInputParsingUtils.parse("The 
quick! !brown*", false, true));
 
-        assertEquals("The quick br own", SearchInputParsingUtils.parse("The 
quick br*'own", false, true));
-        assertEquals("The quick br* own", SearchInputParsingUtils.parse("The 
quick br*'own", true, true));
+        assertEquals("The quick br''own", SearchInputParsingUtils.parse("The 
quick br*'own", false, true));
+        assertEquals("The quick br*''own", SearchInputParsingUtils.parse("The 
quick br*'own", true, true));
     }
 
     @Test
@@ -201,12 +201,12 @@ public class TestSearchInputParsingUtils {
 
     @Test
     public void testSearchInputParsingUtils_parse_differentApostrophes() 
throws Exception {
-        assertEquals("The quic k", SearchInputParsingUtils.parse("The quic'k", 
true));
-        assertEquals("The quic k", SearchInputParsingUtils.parse("The quic’k", 
true));
-        assertEquals("The quic k", SearchInputParsingUtils.parse("The quic‘k", 
true));
-        assertEquals("The quick", SearchInputParsingUtils.parse("The quic'k", 
true, false));
-        assertEquals("The quick", SearchInputParsingUtils.parse("The quic’k", 
true, false));
-        assertEquals("The quick", SearchInputParsingUtils.parse("The quic‘k", 
true, false));
+        assertEquals("The quic''k", SearchInputParsingUtils.parse("The 
quic'k", true));
+        assertEquals("The quic''k", SearchInputParsingUtils.parse("The 
quic’k", true));
+        assertEquals("The quic''k", SearchInputParsingUtils.parse("The 
quic‘k", true));
+        assertEquals("The quic''k", SearchInputParsingUtils.parse("The 
quic'k", true, false));
+        assertEquals("The quic''k", SearchInputParsingUtils.parse("The 
quic’k", true, false));
+        assertEquals("The quic''k", SearchInputParsingUtils.parse("The 
quic‘k", true, false));
     }
 
 }



View it on GitLab: 
https://code.onehippo.org/cms-community/hippo-site-toolkit/compare/bf5bdd00ceea3c8f60eacbf5d08ce151b12561d8...02fc74547155de91fd39e6eaa13956bf014cf281

---
View it on GitLab: 
https://code.onehippo.org/cms-community/hippo-site-toolkit/compare/bf5bdd00ceea3c8f60eacbf5d08ce151b12561d8...02fc74547155de91fd39e6eaa13956bf014cf281
You're receiving this email because of your account on code.onehippo.org.
_______________________________________________
Hippocms-svn mailing list
Hippocms-svn@lists.onehippo.org
https://lists.onehippo.org/mailman/listinfo/hippocms-svn

Reply via email to