Skip to content

Commit

Permalink
Merge pull request #5 from Telicent-io/use-opensearch-2.11
Browse files Browse the repository at this point in the history
Use opensearch 2.11
  • Loading branch information
rvesse committed Jan 16, 2024
2 parents ba5eb61 + fb0f8c9 commit a481647
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 16 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@
.DS_Store
.classpath
.project
.settings/
.settings/
.idea/
pom.xml.*
43 changes: 35 additions & 8 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,27 @@
<modelVersion>4.0.0</modelVersion>
<groupId>io.telicent.opensearch</groupId>
<artifactId>SynonymsPlugin</artifactId>
<version>2.9.0.0</version>
<version>2.11.1.0</version>
<description>A plugin for OpenSearch providing an index-backed synonym
handler</description>
<properties>
<jdk.version>17</jdk.version>
<testcontainer.version>1.17.6</testcontainer.version>
<git-code-format-maven-plugin.version>4.2</git-code-format-maven-plugin.version>
<jackson.version>2.14.2</jackson.version>
<opensearch.version>2.9.0</opensearch.version>
<jackson.version>2.16.1</jackson.version>
<log4j.version>2.22.1</log4j.version>
<opensearch.version>2.11.1</opensearch.version>
<opensearch-client.version>2.8.1</opensearch-client.version>
<opensearch-test.version>2.0.1</opensearch-test.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<slf4j.version>2.0.7</slf4j.version>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<version>3.10.1</version>
<configuration>
<source>${jdk.version}</source>
<target>${jdk.version}</target>
Expand All @@ -31,6 +35,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.6.1</version>
<executions>
<execution>
<id>copy-dependencies</id>
Expand All @@ -45,10 +50,21 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.2.5</version>
<configuration>
<systemProperties>
<opensearch-version>${opensearch.version}</opensearch-version>
</systemProperties>
</configuration>
</plugin>
<!-- Assemble the package for the distributable software. -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.4.2</version>
<configuration>
<appendAssemblyId>false</appendAssemblyId>
<outputDirectory>${project.build.directory}/releases/</outputDirectory>
Expand Down Expand Up @@ -115,7 +131,7 @@
<dependency>
<groupId>org.opensearch.client</groupId>
<artifactId>opensearch-java</artifactId>
<version>2.4.0</version>
<version>${opensearch-client.version}</version>
</dependency>
<dependency>
<groupId>org.opensearch</groupId>
Expand All @@ -138,13 +154,24 @@
<dependency>
<groupId>org.opensearch</groupId>
<artifactId>opensearch-testcontainers</artifactId>
<version>2.0.0</version>
<version>${opensearch-test.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j2-impl</artifactId>
<version>${log4j.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.17.1</version>
<artifactId>log4j-api</artifactId>
<version>${log4j.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@
import org.apache.http.impl.client.BasicCredentialsProvider;
import org.apache.http.impl.nio.client.HttpAsyncClientBuilder;
import org.apache.http.ssl.SSLContextBuilder;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.synonym.SolrSynonymParser;
import org.apache.lucene.util.CharsRef;
Expand All @@ -38,6 +36,8 @@
import org.opensearch.client.opensearch.core.search.Hit;
import org.opensearch.client.transport.OpenSearchTransport;
import org.opensearch.client.transport.rest_client.RestClientTransport;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/** Generates a synonym map from the content of an index * */
public class IndexedSynonymParser extends SolrSynonymParser {
Expand All @@ -50,7 +50,7 @@ public class IndexedSynonymParser extends SolrSynonymParser {
private final String password;
private final int port;

private static final Logger logger = LogManager.getLogger(IndexedSynonymParser.class);
private static final Logger logger = LoggerFactory.getLogger(IndexedSynonymParser.class);

public IndexedSynonymParser(
String host,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ private void setup(boolean security) throws Exception {
// https://github.com/opensearch-project/opensearch-testcontainers

String version = System.getProperty("opensearch-version");
if (version == null) version = "2.9.0";
if (version == null) version = "2.11.1";
LOG.info("Starting docker instance of OpenSearch {}...", version);

container = new OpensearchContainer("opensearchproject/opensearch:" + version);
Expand Down Expand Up @@ -122,15 +122,15 @@ private void close() {

@Test
public void loadSynonymsUnAuthenticated() throws Exception {
laodSynonyms(false);
loadSynonyms(false);
}

@Test
public void loadSynonymsAuthenticated() throws Exception {
laodSynonyms(true);
loadSynonyms(true);
}

private void laodSynonyms(boolean authentication) throws Exception {
private void loadSynonyms(boolean authentication) throws Exception {
setup(authentication);

String username = null;
Expand Down
13 changes: 13 additions & 0 deletions src/test/resources/log4j2-test.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="WARN">
<Appenders>
<Console name="Console" target="SYSTEM_OUT">
<PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
</Console>
</Appenders>
<Loggers>
<Root level="info">
<AppenderRef ref="Console"/>
</Root>
</Loggers>
</Configuration>

0 comments on commit a481647

Please sign in to comment.