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

fix: Refactorings to build against opensearch version 3.0.0-SNAPSHOT #65

Merged
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
8 changes: 6 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ import java.nio.file.Files

buildscript {
repositories {
mavenCentral()
mavenLocal()
maven { url "https://aws.oss.sonatype.org/content/repositories/snapshots" }
mavenCentral()
maven { url "https://plugins.gradle.org/m2/" }
}

dependencies {
Expand Down Expand Up @@ -56,8 +58,10 @@ opensearchplugin {
// In this section you declare the dependencies for your production and test code
// OpenSearch dependency is included due to the build-tools, test-framework as well
repositories {
mavenCentral()
mavenLocal()
maven { url "https://aws.oss.sonatype.org/content/repositories/snapshots" }
mavenCentral()
maven { url "https://plugins.gradle.org/m2/" }
}

dependencies {
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ltrVersion = 2.17.1
opensearchVersion = 2.17.1
opensearchVersion = 3.0.0-SNAPSHOT
luceneVersion = 9.7.0
ow2Version = 9.6
antlrVersion=4.11.1
4 changes: 2 additions & 2 deletions src/main/java/com/o19s/es/ltr/action/LTRStatsAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import org.opensearch.action.ActionRequestBuilder;
import org.opensearch.action.ActionType;
import org.opensearch.action.FailedNodeException;
import org.opensearch.action.support.nodes.BaseNodeRequest;
import org.opensearch.action.support.nodes.BaseNodeResponse;
import org.opensearch.action.support.nodes.BaseNodesRequest;
import org.opensearch.action.support.nodes.BaseNodesResponse;
Expand All @@ -31,6 +30,7 @@
import org.opensearch.core.xcontent.ToXContent;
import org.opensearch.core.xcontent.ToXContentFragment;
import org.opensearch.core.xcontent.XContentBuilder;
import org.opensearch.transport.TransportRequest;

import java.io.IOException;
import java.util.HashSet;
Expand All @@ -55,7 +55,7 @@ public LTRStatsRequestBuilder(OpenSearchClient client) {
}
}

public static class LTRStatsNodeRequest extends BaseNodeRequest {
public static class LTRStatsNodeRequest extends TransportRequest {
private final LTRStatsNodesRequest nodesRequest;

public LTRStatsNodeRequest(LTRStatsNodesRequest nodesRequest) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@
import com.o19s.es.ltr.feature.store.index.Caches;
import org.opensearch.action.FailedNodeException;
import org.opensearch.action.support.ActionFilters;
import org.opensearch.action.support.nodes.BaseNodeRequest;
import org.opensearch.action.support.nodes.TransportNodesAction;
import org.opensearch.cluster.metadata.IndexNameExpressionResolver;
import org.opensearch.cluster.service.ClusterService;
import org.opensearch.common.inject.Inject;
import org.opensearch.core.common.io.stream.StreamInput;
import org.opensearch.common.settings.Settings;
import org.opensearch.threadpool.ThreadPool;
import org.opensearch.transport.TransportRequest;
import org.opensearch.transport.TransportService;

import java.io.IOException;
Expand Down Expand Up @@ -71,7 +71,7 @@ protected CachesStatsNodeResponse nodeOperation(CachesStatsNodeRequest request)
return new CachesStatsNodeResponse(clusterService.localNode()).initFromCaches(caches);
}

public static class CachesStatsNodeRequest extends BaseNodeRequest {
public static class CachesStatsNodeRequest extends TransportRequest {
public CachesStatsNodeRequest() {}

public CachesStatsNodeRequest(StreamInput in) throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import com.o19s.es.ltr.feature.store.index.Caches;
import org.opensearch.action.FailedNodeException;
import org.opensearch.action.support.ActionFilters;
import org.opensearch.action.support.nodes.BaseNodeRequest;
import org.opensearch.action.support.nodes.TransportNodesAction;
import org.opensearch.cluster.metadata.IndexNameExpressionResolver;
import org.opensearch.cluster.service.ClusterService;
Expand All @@ -31,6 +30,7 @@
import org.opensearch.core.common.io.stream.StreamOutput;
import org.opensearch.common.settings.Settings;
import org.opensearch.threadpool.ThreadPool;
import org.opensearch.transport.TransportRequest;
import org.opensearch.transport.TransportService;

import java.io.IOException;
Expand Down Expand Up @@ -88,7 +88,7 @@ protected ClearCachesNodeResponse nodeOperation(ClearCachesNodeRequest request)
return new ClearCachesNodeResponse(clusterService.localNode());
}

public static class ClearCachesNodeRequest extends BaseNodeRequest {
public static class ClearCachesNodeRequest extends TransportRequest {
private ClearCachesNodesRequest request;

public ClearCachesNodeRequest() {}
Expand Down
11 changes: 3 additions & 8 deletions src/main/java/com/o19s/es/ltr/query/StoredLtrQueryBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import com.o19s.es.ltr.feature.store.index.IndexFeatureStore;
import com.o19s.es.ltr.ranker.linear.LinearRanker;
import com.o19s.es.ltr.utils.FeatureStoreLoader;
import org.opensearch.Version;
import org.opensearch.core.ParseField;
import org.opensearch.core.common.ParsingException;
import org.opensearch.core.common.io.stream.NamedWriteable;
Expand Down Expand Up @@ -90,10 +89,8 @@ public StoredLtrQueryBuilder(FeatureStoreLoader storeLoader, StreamInput input)
featureScoreCacheFlag = input.readOptionalBoolean();
featureSetName = input.readOptionalString();
params = input.readMap();
if (input.getVersion().onOrAfter(Version.V_1_0_0)) {//TODO: check this. In the Elastic LTR plugin this is set to 7_0_0
String[] activeFeat = input.readOptionalStringArray();
activeFeatures = activeFeat == null ? null : Arrays.asList(activeFeat);
}
String[] activeFeat = input.readOptionalStringArray();
activeFeatures = activeFeat == null ? null : Arrays.asList(activeFeat);
storeName = input.readOptionalString();
}

Expand Down Expand Up @@ -121,9 +118,7 @@ protected void doWriteTo(StreamOutput out) throws IOException {
out.writeOptionalBoolean(featureScoreCacheFlag);
out.writeOptionalString(featureSetName);
out.writeMap(params);
if (out.getVersion().onOrAfter(Version.V_1_0_0)) {
out.writeOptionalStringArray(activeFeatures != null ? activeFeatures.toArray(new String[0]) : null);
}
out.writeOptionalStringArray(activeFeatures != null ? activeFeatures.toArray(new String[0]) : null);
out.writeOptionalString(storeName);
}

Expand Down
Loading