From 84c6a68f559d7d25b64f7936f7a713e693f6c215 Mon Sep 17 00:00:00 2001 From: Jackie Han Date: Thu, 1 Feb 2024 11:37:13 -0800 Subject: [PATCH] test Signed-off-by: Jackie Han --- .../org/opensearch/flowframework/common/CommonValue.java | 2 ++ .../processor/FlowFrameworkResponseProcessor.java | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/src/main/java/org/opensearch/flowframework/common/CommonValue.java b/src/main/java/org/opensearch/flowframework/common/CommonValue.java index ed3eb0395..e65f2a2f3 100644 --- a/src/main/java/org/opensearch/flowframework/common/CommonValue.java +++ b/src/main/java/org/opensearch/flowframework/common/CommonValue.java @@ -65,6 +65,8 @@ private CommonValue() {} /** The field name for provision workflow within a use case template*/ public static final String PROVISION_WORKFLOW = "provision"; + public static final String SEARCH_WORKFLOW = "search"; + /* * Constants associated with plugin configuration */ diff --git a/src/main/java/org/opensearch/flowframework/processor/FlowFrameworkResponseProcessor.java b/src/main/java/org/opensearch/flowframework/processor/FlowFrameworkResponseProcessor.java index 71d4f27f4..7262f45f3 100644 --- a/src/main/java/org/opensearch/flowframework/processor/FlowFrameworkResponseProcessor.java +++ b/src/main/java/org/opensearch/flowframework/processor/FlowFrameworkResponseProcessor.java @@ -9,6 +9,8 @@ import org.opensearch.client.Client; import org.opensearch.core.action.ActionListener; import org.opensearch.flowframework.model.Template; +import org.opensearch.flowframework.model.Workflow; +import org.opensearch.flowframework.model.WorkflowNode; import org.opensearch.flowframework.transport.GetWorkflowAction; import org.opensearch.flowframework.transport.WorkflowRequest; import org.opensearch.search.pipeline.AbstractProcessor; @@ -18,6 +20,8 @@ import java.util.Map; import static org.opensearch.flowframework.common.CommonValue.GLOBAL_CONTEXT_INDEX; +import static org.opensearch.flowframework.common.CommonValue.PROVISION_WORKFLOW; +import static org.opensearch.flowframework.common.CommonValue.SEARCH_WORKFLOW; import static org.opensearch.ingest.ConfigurationUtils.readStringProperty; public class FlowFrameworkResponseProcessor extends AbstractProcessor implements SearchResponseProcessor { @@ -59,6 +63,9 @@ public SearchResponse processResponse(SearchRequest request, SearchResponse resp GetResponse getResponse = client.get(getRequest).get(); System.out.println("source: " + getResponse.getSourceAsString()); Template template = Template.parse(getResponse.getSourceAsString()); + Workflow searchWorkflow = template.workflows().get(SEARCH_WORKFLOW); + WorkflowNode workflowNode = searchWorkflow.nodes().get(0); + System.out.println("node: " + workflowNode.type()); System.out.println("template: " + template.toJson()); return response;