@@ -152,13 +152,15 @@ public void fullTextQueryWithDifferentBoosts() throws Exception {
152152 c .setProperty ("propb" , "Hello folks" );
153153 test .addChild ("d" ).setProperty ("propb" , "baz" );
154154 root .commit ();
155-
156- assertEventually (() -> {
157- assertQuery ("//*[jcr:contains(., 'Hello')]" , XPATH , List .of ("/test/c" , "/test/b" , "/test/a" ), true , true );
158- assertQuery ("//*[jcr:contains(., 'Hello')] order by @jcr:score ascending" , XPATH ,
155+ for (String prefix : getPrefixes ()) {
156+ assertEventually (() -> {
157+ assertQuery ("//*[jcr:contains(., '" + prefix + "Hello')]" , XPATH ,
158+ List .of ("/test/c" , "/test/b" , "/test/a" ), true , true );
159+ assertQuery ("//*[jcr:contains(., '" + prefix + "Hello')] order by @jcr:score ascending" , XPATH ,
159160 List .of ("/test/a" , "/test/b" , "/test/c" ), true , true );
160- assertQuery ("//*[jcr:contains(., 'people')]" , XPATH , List .of ("/test/c" ));
161- });
161+ assertQuery ("//*[jcr:contains(., '" + prefix + "people')]" , XPATH , List .of ("/test/c" ));
162+ });
163+ }
162164 }
163165
164166 @ Test
@@ -197,11 +199,13 @@ public void onlyNodeScopeIndexedQuery() throws Exception {
197199 d .setProperty ("b" , "world" );
198200 root .commit ();
199201
200- assertEventually (() -> {
201- assertQuery ("//*[jcr:contains(., 'Hello')]" , XPATH , List .of ("/test/nodea" , "/test/nodec" , "/test/noded" ));
202- assertQuery ("//*[jcr:contains(., 'hello world')]" , XPATH , List .of ("/test/nodec" , "/test/noded" ));
203- assertQuery ("//*[jcr:contains(., 'hello OR world')]" , XPATH , List .of ("/test/nodea" , "/test/nodeb" , "/test/nodec" , "/test/noded" ));
204- });
202+ for (String prefix : getPrefixes ()) {
203+ assertEventually (() -> {
204+ assertQuery ("//*[jcr:contains(., '" + prefix + "Hello')]" , XPATH , List .of ("/test/nodea" , "/test/nodec" , "/test/noded" ));
205+ assertQuery ("//*[jcr:contains(., '" + prefix + "hello world')]" , XPATH , List .of ("/test/nodec" , "/test/noded" ));
206+ assertQuery ("//*[jcr:contains(., '" + prefix + "hello OR world')]" , XPATH , List .of ("/test/nodea" , "/test/nodeb" , "/test/nodec" , "/test/noded" ));
207+ });
208+ }
205209 }
206210
207211 @ Test
@@ -224,10 +228,12 @@ public void nodeScopeIndexedQuery() throws Exception {
224228 d .setProperty ("b" , "world" );
225229 root .commit ();
226230
227- assertEventually (() -> {
228- assertQuery ("//*[jcr:contains(., 'Hello')]" , XPATH , List .of ("/test/a" , "/test/c" , "/test/d" ));
229- assertQuery ("//*[jcr:contains(., 'hello world')]" , XPATH , List .of ("/test/c" , "/test/d" ));
230- });
231+ for (String prefix : getPrefixes ()) {
232+ assertEventually (() -> {
233+ assertQuery ("//*[jcr:contains(., '" + prefix + "Hello')]" , XPATH , List .of ("/test/a" , "/test/c" , "/test/d" ));
234+ assertQuery ("//*[jcr:contains(., '" + prefix + "hello world')]" , XPATH , List .of ("/test/c" , "/test/d" ));
235+ });
236+ }
231237 }
232238
233239 @ Test
@@ -250,10 +256,12 @@ public void propertyIndexWithNodeScopeIndexedQuery() throws Exception {
250256 d .setProperty ("b" , "world" );
251257 root .commit ();
252258
253- assertEventually (() -> {
254- assertQuery ("//*[jcr:contains(., 'Hello')]" , XPATH , List .of ("/test/nodea" , "/test/nodec" , "/test/noded" ));
255- assertQuery ("//*[jcr:contains(., 'hello world')]" , XPATH , List .of ("/test/nodec" , "/test/noded" ));
256- });
259+ for (String prefix : getPrefixes ()) {
260+ assertEventually (() -> {
261+ assertQuery ("//*[jcr:contains(., '" + prefix + "Hello')]" , XPATH , List .of ("/test/nodea" , "/test/nodec" , "/test/noded" ));
262+ assertQuery ("//*[jcr:contains(., '" + prefix + "hello world')]" , XPATH , List .of ("/test/nodec" , "/test/noded" ));
263+ });
264+ }
257265 }
258266
259267 /*
@@ -280,10 +288,12 @@ public void onlyAnalyzedPropertyShouldNotBeReturnedForNodeScopeIndexedQuery() th
280288 d .setProperty ("b" , "world" );
281289 root .commit ();
282290
283- assertEventually (() -> {
284- assertQuery ("//*[jcr:contains(., 'Hello')]" , XPATH , List .of ("/test/nodec" , "/test/noded" ));
285- assertQuery ("//*[jcr:contains(., 'hello world')]" , XPATH , List .of ("/test/nodec" ));
286- });
291+ for (String prefix : getPrefixes ()) {
292+ assertEventually (() -> {
293+ assertQuery ("//*[jcr:contains(., '" + prefix + "Hello')]" , XPATH , List .of ("/test/nodec" , "/test/noded" ));
294+ assertQuery ("//*[jcr:contains(., '" + prefix + "hello world')]" , XPATH , List .of ("/test/nodec" ));
295+ });
296+ }
287297 }
288298
289299 @ Test
@@ -321,8 +331,10 @@ public void fulltextWithModifiedNodeScopeIndex() throws Exception {
321331 index .setProperty (FulltextIndexConstants .PROP_REFRESH_DEFN , true );
322332 root .commit ();
323333
324- assertEventually (() ->
325- assertQuery ("//*[jcr:contains(., 'jpg')]" , XPATH , List .of ("/test/a" )));
334+ for (String prefix : getPrefixes ()) {
335+ assertEventually (() ->
336+ assertQuery ("//*[jcr:contains(., '" + prefix + "jpg')]" , XPATH , List .of ("/test/a" )));
337+ }
326338 }
327339
328340 @ Test
@@ -346,14 +358,16 @@ public void fulltextWithMalformedFields() throws Exception {
346358
347359 root .commit ();
348360
349- assertEventually (() -> {
350- assertQuery ("//*[jcr:contains(., 'foo')]" , XPATH , List .of ("/test/a" ));
351- assertQuery ("//*[jcr:contains(., '2025')]" , XPATH , List .of ("/test/b" ));
352- assertQuery ("//*[jcr:contains(., '123')]" , XPATH , List .of ("/test/c" ));
353- assertQuery ("//*[jcr:contains(., '456.78')]" , XPATH , List .of ("/test/d" ));
354- assertQuery ("//*[jcr:contains(., 'true')]" , XPATH , List .of ("/test/e" ));
361+ for (String prefix : getPrefixes ()) {
362+ assertEventually (() -> {
363+ assertQuery ("//*[jcr:contains(., '" + prefix + "foo')]" , XPATH , List .of ("/test/a" ));
364+ assertQuery ("//*[jcr:contains(., '" + prefix + "2025')]" , XPATH , List .of ("/test/b" ));
365+ assertQuery ("//*[jcr:contains(., '" + prefix + "123')]" , XPATH , List .of ("/test/c" ));
366+ assertQuery ("//*[jcr:contains(., '" + prefix + "456.78')]" , XPATH , List .of ("/test/d" ));
367+ assertQuery ("//*[jcr:contains(., '" + prefix + "true')]" , XPATH , List .of ("/test/e" ));
355368 }
356- );
369+ );
370+ }
357371 }
358372
359373 protected void assertEventually (Runnable r ) {
@@ -396,4 +410,7 @@ protected String explain(String query, String lang) {
396410 return executeQuery (explain , lang ).get (0 );
397411 }
398412
413+ protected String [] getPrefixes () {
414+ return new String []{"" };
415+ }
399416}
0 commit comments