Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
Signed-off-by: Jackie Han <[email protected]>
  • Loading branch information
jackiehanyang committed Feb 1, 2024
1 parent 0ec4407 commit 84c6a68
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 {
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 84c6a68

Please sign in to comment.