Skip to content

Apache Lucene open-source search software

LUCENE-9134: UAX29URLEmailTokenizerImpl regeneration. This requires TONS of memory and time... insane compared to the size of the input. None of my machines pass it without at least 12 gigs of heap (!).

Dawid Weiss6bde0f3ec8a3
diff --git a/gradle/generation/jflex.gradle b/gradle/generation/jflex.gradle
index ab53617f2b0..6611011962e 100644
--- a/gradle/generation/jflex.gradle
+++ b/gradle/generation/jflex.gradle
@@ -15,6 +15,7 @@ configure(rootProject) {
group "generation"
dependsOn ":lucene:core:jflexStandardTokenizerImpl"
+ dependsOn ":lucene:analysis:common:jflexUAX29URLEmailTokenizerImpl"
}
}
@@ -26,6 +27,9 @@ class JFlexTask extends DefaultTask {
@Input
File skeleton
+ @Optional
+ String heapSize
+
JFlexTask() {
dependsOn(project.rootProject.configurations.jflex)
}
@@ -50,6 +54,10 @@ class JFlexTask extends DefaultTask {
"--encoding", "UTF-8",
]
+ if (heapSize) {
+ maxHeapSize = heapSize
+ }
+
if (skeleton) {
args += ["--skel", skeleton.absolutePath]
}
@@ -87,3 +95,27 @@ configure(project(":lucene:core")) {
}
}
}
+
+configure(project(":lucene:analysis:common")) {
+ task jflexUAX29URLEmailTokenizerImpl(type: JFlexTask) {
+ description "Regenerate UAX29URLEmailTokenizerImpl.java"
+ group "generation"
+
+ jflexFile = file('src/java/org/apache/lucene/analysis/standard/UAX29URLEmailTokenizerImpl.jflex')
+ skeleton = project(":lucene:core").file("src/data/jflex/skeleton.disable.buffer.expansion.txt")
+ heapSize = "12g"
+
+ doFirst {
+ logger.lifecycle("Regenerating UAX29URLEmailTokenizerImpl. This may take a long time (and requires tons of memory).")
+ }
+
+ doLast {
+ ant.replace(
+ file: file('src/java/org/apache/lucene/analysis/standard/UAX29URLEmailTokenizerImpl.java'),
+ encoding: "UTF-8",
+ token: "private static final int ZZ_BUFFERSIZE =",
+ value: "private int ZZ_BUFFERSIZE ="
+ )
+ }
+ }
+}