-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Vamsi Manohar <[email protected]> SQL in search API Signed-off-by: Vamsi Manohar <[email protected]>
- Loading branch information
Showing
10 changed files
with
305 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
server/src/main/java/org/opensearch/search/externalengine/QueryEngine.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
*/ | ||
|
||
package org.opensearch.search.externalengine; | ||
|
||
import org.opensearch.action.search.SearchRequest; | ||
import org.opensearch.action.search.SearchResponse; | ||
import org.opensearch.core.action.ActionListener; | ||
import org.opensearch.core.common.io.stream.NamedWriteable; | ||
import org.opensearch.core.xcontent.ToXContentObject; | ||
|
||
/** | ||
* QueryEngine abstract interface. | ||
*/ | ||
public abstract class QueryEngine implements NamedWriteable, ToXContentObject { | ||
public abstract void executeQuery(SearchRequest searchRequest, | ||
ActionListener<SearchResponse> actionListener); | ||
} |
68 changes: 68 additions & 0 deletions
68
server/src/main/java/org/opensearch/search/externalengine/QueryEngineExtBuilder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
*/ | ||
|
||
/* | ||
* Licensed to Elasticsearch under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch licenses this file to you under | ||
* the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
/* | ||
* Modifications Copyright OpenSearch Contributors. See | ||
* GitHub history for details. | ||
*/ | ||
|
||
package org.opensearch.search.externalengine; | ||
|
||
import org.opensearch.common.CheckedFunction; | ||
import org.opensearch.common.annotation.PublicApi; | ||
import org.opensearch.core.common.io.stream.NamedWriteable; | ||
import org.opensearch.core.common.io.stream.StreamInput; | ||
import org.opensearch.core.common.io.stream.StreamOutput; | ||
import org.opensearch.core.common.io.stream.Writeable; | ||
import org.opensearch.core.xcontent.ToXContentFragment; | ||
import org.opensearch.plugins.SearchPlugin; | ||
import org.opensearch.plugins.SearchPlugin.SearchExtSpec; | ||
|
||
/** | ||
* Intermediate serializable representation of a search ext section. To be subclassed by plugins that support | ||
* a custom section as part of a search request, which will be provided within the ext element. | ||
* Any state needs to be serialized as part of the {@link Writeable#writeTo(StreamOutput)} method and | ||
* read from the incoming stream, usually done adding a constructor that takes {@link StreamInput} as | ||
* an argument. | ||
* <p> | ||
* Registration happens through {@link SearchPlugin#getSearchExts()}, which also needs a {@link CheckedFunction} that's able to parse | ||
* the incoming request from the REST layer into the proper {@link QueryEngineExtBuilder} subclass. | ||
* <p> | ||
* {@link #getWriteableName()} must return the same name as the one used for the registration | ||
* of the {@link SearchExtSpec}. | ||
* | ||
* @see SearchExtSpec | ||
* | ||
* @opensearch.api | ||
*/ | ||
@PublicApi(since = "1.0.0") | ||
public abstract class QueryEngineExtBuilder implements NamedWriteable, ToXContentFragment { | ||
|
||
public abstract int hashCode(); | ||
|
||
public abstract boolean equals(Object obj); | ||
} |
30 changes: 30 additions & 0 deletions
30
server/src/main/java/org/opensearch/search/externalengine/QueryEngineParser.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
*/ | ||
|
||
package org.opensearch.search.externalengine; | ||
|
||
import java.io.IOException; | ||
import org.opensearch.core.xcontent.XContentParser; | ||
import org.opensearch.index.query.QueryBuilder; | ||
|
||
|
||
/** | ||
* Query Engine Parser. | ||
* @param <T> extend QuerEgnien. | ||
*/ | ||
@FunctionalInterface | ||
public interface QueryEngineParser<T extends QueryEngine> { | ||
|
||
/** | ||
* Creates a new {@link QueryBuilder} from the query held by the | ||
* {@link XContentParser}. The state on the parser contained in this context | ||
* will be changed as a side effect of this method call | ||
*/ | ||
T fromXContent(XContentParser parser) throws IOException; | ||
|
||
} |
Oops, something went wrong.