This is an automated email from the ASF dual-hosted git repository.

reschke pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/jackrabbit-oak.git


The following commit(s) were added to refs/heads/trunk by this push:
     new dcae752850 OAK-10777: oak-lucene: add test coverage for stack overflow 
based on very long and complex regexp using JCR lucene native query (#1434)
dcae752850 is described below

commit dcae75285040b9f60d8464d5f8ea9d210d3412a6
Author: Julian Reschke <resc...@apache.org>
AuthorDate: Fri Apr 26 18:25:17 2024 +0200

    OAK-10777: oak-lucene: add test coverage for stack overflow based on very 
long and complex regexp using JCR lucene native query (#1434)
---
 .../oak/plugins/index/FullTextIndexCommonTest.java | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git 
a/oak-search/src/test/java/org/apache/jackrabbit/oak/plugins/index/FullTextIndexCommonTest.java
 
b/oak-search/src/test/java/org/apache/jackrabbit/oak/plugins/index/FullTextIndexCommonTest.java
index e32c77fcdd..e02d1ead07 100644
--- 
a/oak-search/src/test/java/org/apache/jackrabbit/oak/plugins/index/FullTextIndexCommonTest.java
+++ 
b/oak-search/src/test/java/org/apache/jackrabbit/oak/plugins/index/FullTextIndexCommonTest.java
@@ -22,6 +22,7 @@ import org.apache.jackrabbit.oak.api.Type;
 import org.apache.jackrabbit.oak.plugins.index.search.FulltextIndexConstants;
 import 
org.apache.jackrabbit.oak.plugins.index.search.util.IndexDefinitionBuilder;
 import org.apache.jackrabbit.oak.query.AbstractQueryTest;
+import org.junit.Ignore;
 import org.junit.Test;
 
 import java.util.List;
@@ -63,6 +64,27 @@ public abstract class FullTextIndexCommonTest extends 
AbstractQueryTest {
         });
     }
 
+    @Test
+    @Ignore("OAK-10777")
+    public void fullTextQueryRegExp() throws Exception {
+        Tree index = setup(builder -> 
builder.indexRule("nt:base").property("propa").analyzed(), idx -> {
+                },
+                "propa");
+
+        // test borrowed from: https://github.com/apache/lucene/issues/11537
+        StringBuilder strBuilder = new StringBuilder();
+        for (int i = 0; i < 50000; i++) {
+            strBuilder.append("b");
+        }
+
+        String query = "//*[rep:native('lucene', '/" + strBuilder + "/')]";
+
+        assertEventually(() -> {
+            assertThat(explain(query, XPATH), 
containsString(indexOptions.getIndexType() + ":" + index.getName()));
+            assertQuery(query, XPATH, List.of());
+        });
+    }
+
     @Test
     public void fullTextQueryWithDifferentBoosts() throws Exception {
         setup(builder -> {

Reply via email to