Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade org.apache.lucene to 9.12.1 #2738

Open
wants to merge 2 commits into
base: integration
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
<version.kryo>2.20</version.kryo>
<version.kryonet>2.20</version.kryonet>
<version.log4j2>2.17.2</version.log4j2>
<version.lucene>7.5.0</version.lucene>
<version.lucene>9.12.1</version.lucene>
<version.maven-install-plugin>2.5.2</version.maven-install-plugin>
<version.metrics-cdi>1.6.0</version.metrics-cdi>
<version.minlog>1.2</version.minlog>
Expand Down Expand Up @@ -828,7 +828,7 @@
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-analyzers-common</artifactId>
<artifactId>lucene-analysis-common</artifactId>
<version>${version.lucene}</version>
</dependency>
<dependency>
Expand Down
2 changes: 1 addition & 1 deletion warehouse/ingest-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-analyzers-common</artifactId>
<artifactId>lucene-analysis-common</artifactId>
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
package datawave.ingest.data.tokenize;

import java.io.Reader;

import org.apache.lucene.analysis.CharArraySet;
import org.apache.lucene.analysis.StopwordAnalyzerBase;
import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.analysis.classic.ClassicFilter;
import org.apache.lucene.analysis.core.LowerCaseFilter;
import org.apache.lucene.analysis.core.StopAnalyzer;
import org.apache.lucene.analysis.core.StopFilter;
import org.apache.lucene.analysis.en.EnglishAnalyzer;
import org.apache.lucene.analysis.standard.ClassicFilter;

/**
* Filters {@link StandardTokenizer} with {@link LowerCaseFilter} {@link ClassicFilter} and {@link StopFilter}, using a list of English stop words (unless
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import org.apache.log4j.Logger;
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.CharArraySet;
import org.apache.lucene.analysis.en.EnglishAnalyzer;

import datawave.ingest.data.config.DataTypeHelper;
import datawave.util.ObjectFactory;
Expand Down Expand Up @@ -373,7 +374,7 @@ public static final CharArraySet getStopWords(DataTypeHelper helper, Configurati
}
} else {
log.warn("Utilizing default stopword set. Tokenization and indexing may generate unwanted data");
stopWords = org.apache.lucene.analysis.core.StopAnalyzer.ENGLISH_STOP_WORDS_SET;
stopWords = EnglishAnalyzer.ENGLISH_STOP_WORDS_SET;
}
return stopWords;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

import org.apache.log4j.Logger;
import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.analysis.classic.ClassicFilter;
import org.apache.lucene.analysis.core.LowerCaseFilter;
import org.apache.lucene.analysis.ngram.NGramTokenizer;
import org.apache.lucene.analysis.standard.ClassicFilter;
import org.apache.lucene.analysis.tokenattributes.CharTermAttribute;

import com.google.common.hash.BloomFilter;
Expand Down
2 changes: 1 addition & 1 deletion warehouse/ingest-csv/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-analyzers-common</artifactId>
<artifactId>lucene-analysis-common</artifactId>
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
Expand Down
2 changes: 1 addition & 1 deletion warehouse/ingest-json/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-analyzers-common</artifactId>
<artifactId>lucene-analysis-common</artifactId>
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ LOG4J2_SLF4J_JAR=$(findJar log4j-slf4j-impl)
JSON_SIMPLE=$(findJar json-simple)
LUCENE_JAR=$(findJar lucene-core)
LUCENE_JAR=$LUCENE_JAR:$(findJar lucene-queryparser)
LUCENE_JAR=$LUCENE_JAR:$(findJar lucene-analyzers-common)
LUCENE_JAR=$LUCENE_JAR:$(findJar lucene-analysis-common)
THRIFT_JAR=$(findJar libthrift)
AC_CORE_JAR=$(findAccumuloJar accumulo-core)
AC_SERVER_JAR=$(findAccumuloJar accumulo-server-base)
Expand Down
2 changes: 1 addition & 1 deletion warehouse/ingest-wikipedia/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-analyzers-common</artifactId>
<artifactId>lucene-analysis-common</artifactId>
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
Expand Down
2 changes: 1 addition & 1 deletion warehouse/query-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-analyzers-common</artifactId>
<artifactId>lucene-analysis-common</artifactId>
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
import java.util.Map;
import java.util.SortedSet;

import javax.management.ObjectName;

import org.apache.accumulo.core.data.Key;
import org.apache.accumulo.core.data.Range;
import org.apache.accumulo.core.data.Value;
Expand All @@ -21,11 +23,14 @@
import org.apache.hadoop.io.compress.CompressionCodec;
import org.apache.lucene.store.DataInput;
import org.apache.lucene.store.InputStreamDataInput;
import org.apache.lucene.util.BytesRefBuilder;
import org.apache.lucene.util.IntsRef;
import org.apache.lucene.util.IntsRefBuilder;
import org.apache.lucene.util.fst.FST;
import org.apache.lucene.util.fst.FSTCompiler;
import org.apache.lucene.util.fst.NoOutputs;
import org.apache.lucene.util.fst.Outputs;
import org.apache.lucene.util.fst.PositiveIntOutputs;
import org.apache.lucene.util.fst.Util;

import datawave.core.iterators.filesystem.FileSystemCache;
Expand Down Expand Up @@ -185,28 +190,16 @@ protected boolean matches(Key k) throws IOException {

public static FST<?> getFST(SortedSet<String> values) throws IOException {
final IntsRefBuilder irBuilder = new IntsRefBuilder();
// The builder options with defaults
FST.INPUT_TYPE inputType = FST.INPUT_TYPE.BYTE1;
int minSuffixCount1 = 0;
int minSuffixCount2 = 0;
boolean doShareSuffix = true;
boolean doShareNonSingletonNodes = true;
int shareMaxTailLength = Integer.MAX_VALUE;

boolean allowArrayArcs = true;
int bytesPageBits = 15;
final Outputs<Object> outputs = NoOutputs.getSingleton();

// create the FST from the values
org.apache.lucene.util.fst.Builder<Object> fstBuilder = new org.apache.lucene.util.fst.Builder<>(inputType, minSuffixCount1, minSuffixCount2,
doShareSuffix, doShareNonSingletonNodes, shareMaxTailLength, outputs, allowArrayArcs, bytesPageBits);

// Add the values to the compiler and create the FST.
FSTCompiler<Object> fstCompiler = new FSTCompiler.Builder<>(FST.INPUT_TYPE.BYTE1, outputs).build();
for (String value : values) {
Util.toUTF16(value, irBuilder);
final IntsRef scratchInt = irBuilder.get();
fstBuilder.add(scratchInt, outputs.getNoOutput());
fstCompiler.add(scratchInt, outputs.getNoOutput());
}
return fstBuilder.finish();
return FST.fromFSTReader(fstCompiler.compile(), fstCompiler.getFSTReader());
}

/** Utility class to load one instance of any FST per classloader */
Expand Down Expand Up @@ -260,8 +253,10 @@ public static FST<Object> loadFSTFromFile(Path filename, String compressionCodec
fis = codec.createInputStream(fis);
}
NoOutputs outputs = NoOutputs.getSingleton();

DataInput di = new InputStreamDataInput(fis);
return new FST<>(di, outputs);
FST.FSTMetadata<Object> metadata = FST.readMetadata(di, outputs);
return new FST<>(metadata, di);
}

public static synchronized void clear(String file) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ protected void assignNodeByField(JexlNode origNode, JexlNode subNode, Multimap<S

protected URI createFst(SortedSet<String> values) throws IOException, ClassNotFoundException, InstantiationException, IllegalAccessException,
NoSuchMethodException, InvocationTargetException {
FST fst = DatawaveFieldIndexListIteratorJexl.getFST(values);
FST<?> fst = DatawaveFieldIndexListIteratorJexl.getFST(values);

// now serialize to our file system
CompressionCodec codec = null;
Expand All @@ -357,7 +357,7 @@ protected URI createFst(SortedSet<String> values) throws IOException, ClassNotFo
}

OutputStreamDataOutput outStream = new OutputStreamDataOutput(fstFileOut);
fst.save(outStream);
fst.save(outStream, outStream);
outStream.close();

return fstFile.toUri();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import org.apache.lucene.queryparser.flexible.messages.MessageImpl;
import org.apache.lucene.queryparser.flexible.standard.nodes.RegexpQueryNode;
import org.apache.lucene.queryparser.flexible.standard.nodes.TermRangeQueryNode;
import org.apache.lucene.search.FuzzyQuery;

@SuppressWarnings("all")
public class AccumuloSyntaxParser implements SyntaxParser, AcumuloSyntaxParserConstants {
Expand Down Expand Up @@ -387,7 +388,7 @@ final public QueryNode Term(CharSequence field) throws ParseException {
boolean endInc = false;
QueryNode q = null;
FieldQueryNode qLower, qUpper;
float defaultMinSimilarity = org.apache.lucene.search.FuzzyQuery.defaultMinSimilarity;
float defaultMinSimilarity = FuzzyQuery.defaultMaxEdits;
switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
case FUNCTION:
case TERM:
Expand Down
Loading