Skip to content

Commit

Permalink
Working on standalone implementation.
Browse files Browse the repository at this point in the history
Signed-off-by: jzonthemtn <[email protected]>
  • Loading branch information
jzonthemtn committed Dec 17, 2024
1 parent 3fb1add commit 17dcece
Show file tree
Hide file tree
Showing 9 changed files with 52 additions and 227 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ repositories {
}

dependencies {
implementation 'org.opensearch.client:opensearch-java:2.19.0'
implementation 'org.apache.logging.log4j:log4j-core:2.24.3'
implementation 'com.fasterxml.jackson.core:jackson-annotations:2.18.2'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.18.2'
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package org.opensearch.eval;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

public class Constants {

private static final Logger LOGGER = LogManager.getLogger(Constants.class);

/**
* The name of the UBI index containing the queries. This should not be changed.
*/
public static final String UBI_QUERIES_INDEX_NAME = "ubi_queries";

/**
* The name of the UBI index containing the events. This should not be changed.
*/
public static final String UBI_EVENTS_INDEX_NAME = "ubi_events";

/**
* The name of the index to store the scheduled jobs to create implicit judgments.
*/
public static final String SCHEDULED_JOBS_INDEX_NAME = "search_quality_eval_scheduled_jobs";

/**
* The name of the index to store the completed jobs to create implicit judgments.
*/
public static final String COMPLETED_JOBS_INDEX_NAME = "search_quality_eval_completed_jobs";

/**
* The name of the index that stores the query sets.
*/
public static final String QUERY_SETS_INDEX_NAME = "search_quality_eval_query_sets";

/**
* The name of the index that stores the metrics for the dashboard.
*/
public static final String DASHBOARD_METRICS_INDEX_NAME = "sqe_metrics_sample_data";

/**
* The name of the index that stores the implicit judgments.
*/
public static final String JUDGMENTS_INDEX_NAME = "judgments";

}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import org.opensearch.client.Client;
import org.opensearch.client.Requests;
import org.opensearch.common.unit.TimeValue;
import org.opensearch.eval.SearchQualityEvaluationPlugin;
import org.opensearch.eval.judgments.clickmodel.ClickModel;
import org.opensearch.eval.judgments.model.ClickthroughRate;
import org.opensearch.eval.judgments.model.Judgment;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,7 @@

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.opensearch.action.search.SearchRequest;
import org.opensearch.action.search.SearchResponse;
import org.opensearch.client.Client;
import org.opensearch.eval.SearchQualityEvaluationPlugin;
import org.opensearch.index.query.BoolQueryBuilder;
import org.opensearch.index.query.QueryBuilders;
import org.opensearch.search.builder.SearchSourceBuilder;

import java.util.ArrayList;
import java.util.Collection;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import org.opensearch.action.search.SearchResponse;
import org.opensearch.client.Client;
import org.opensearch.core.action.ActionListener;
import org.opensearch.eval.SearchQualityEvaluationPlugin;
import org.opensearch.eval.metrics.DcgSearchMetric;
import org.opensearch.eval.metrics.NdcgSearchMetric;
import org.opensearch.eval.metrics.PrecisionSearchMetric;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import org.opensearch.action.support.WriteRequest;
import org.opensearch.client.node.NodeClient;
import org.opensearch.core.action.ActionListener;
import org.opensearch.eval.SearchQualityEvaluationPlugin;
import org.opensearch.eval.Constants;
import org.opensearch.eval.utils.TimeUtils;

import java.util.ArrayList;
Expand Down Expand Up @@ -73,7 +73,7 @@ protected String indexQuerySet(final NodeClient client, final String name, final
final String querySetId = UUID.randomUUID().toString();

// TODO: Create a mapping for the query set index.
final IndexRequest indexRequest = new IndexRequest().index(SearchQualityEvaluationPlugin.QUERY_SETS_INDEX_NAME)
final IndexRequest indexRequest = new IndexRequest().index(Constants.QUERY_SETS_INDEX_NAME)
.id(querySetId)
.source(querySet)
.setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import org.opensearch.action.search.SearchRequest;
import org.opensearch.action.search.SearchResponse;
import org.opensearch.client.node.NodeClient;
import org.opensearch.eval.SearchQualityEvaluationPlugin;
import org.opensearch.eval.Constants;
import org.opensearch.index.query.QueryBuilders;
import org.opensearch.search.SearchHit;
import org.opensearch.search.builder.SearchSourceBuilder;
Expand Down Expand Up @@ -53,7 +53,7 @@ public String sample() throws Exception {
searchSourceBuilder.from(0);
searchSourceBuilder.size(parameters.getQuerySetSize());

final SearchRequest searchRequest = new SearchRequest(SearchQualityEvaluationPlugin.UBI_QUERIES_INDEX_NAME).source(searchSourceBuilder);
final SearchRequest searchRequest = new SearchRequest(Constants.UBI_QUERIES_INDEX_NAME).source(searchSourceBuilder);

// TODO: Don't use .get()
final SearchResponse searchResponse = client.search(searchRequest).get();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import org.opensearch.action.search.SearchScrollRequest;
import org.opensearch.client.node.NodeClient;
import org.opensearch.common.unit.TimeValue;
import org.opensearch.eval.SearchQualityEvaluationPlugin;
import org.opensearch.eval.Constants;
import org.opensearch.index.query.QueryBuilders;
import org.opensearch.search.Scroll;
import org.opensearch.search.SearchHit;
Expand Down Expand Up @@ -69,7 +69,7 @@ public String sample() throws Exception {
searchSourceBuilder.size(10000);
final Scroll scroll = new Scroll(TimeValue.timeValueMinutes(10L));

final SearchRequest searchRequest = new SearchRequest(SearchQualityEvaluationPlugin.UBI_QUERIES_INDEX_NAME);
final SearchRequest searchRequest = new SearchRequest(Constants.UBI_QUERIES_INDEX_NAME);
searchRequest.scroll(scroll);
searchRequest.source(searchSourceBuilder);

Expand Down

0 comments on commit 17dcece

Please sign in to comment.