Skip to content

Commit

Permalink
OAK-10777: oak-lucene: add test coverage for stack overflow based on …
Browse files Browse the repository at this point in the history
…very long and complex regexp using JCR lucene native query (#1434)
  • Loading branch information
reschke committed Apr 26, 2024
1 parent 53b51f2 commit dcae752
Showing 1 changed file with 22 additions and 0 deletions.
Expand Up @@ -22,6 +22,7 @@
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;
Expand Down Expand Up @@ -63,6 +64,27 @@ public void fullTextQuery() throws Exception {
});
}

@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 -> {
Expand Down

0 comments on commit dcae752

Please sign in to comment.