-
Notifications
You must be signed in to change notification settings - Fork 817
Migrate Schema Designer to JAX-RS Apis. Fix some bugs. #4203
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
base: main
Are you sure you want to change the base?
Changes from all commits
8812129
42395bc
20f4431
de90529
912c762
7c16593
b382a4c
233162e
11f5209
6a46d40
bcb6a86
115fccb
6756865
c7e0099
810cb96
c04147f
7f6274c
d05be2f
0881dba
b021f15
9667896
91be03c
a3befe4
0520952
9e3f38d
b52c891
f53de8f
13a2abf
b6a69de
42db2a3
ac0a661
96efd9d
46d3042
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| # See https://github.com/apache/solr/blob/main/dev-docs/changelog.adoc | ||
| title: The "analyze" existing documents feature of Schema Designer was fixed. Added a new ConfigSet.Download and ConfigSet.GetFile capablities to SolrJ. | ||
| type: fixed # added, changed, fixed, deprecated, removed, dependency_update, security, other | ||
| authors: | ||
| - name: Eric Pugh | ||
| links: | ||
| - name: SOLR-18152 | ||
| url: https://issues.apache.org/jira/browse/SOLR-18152 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,165 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one or more | ||
| * contributor license agreements. See the NOTICE file distributed with | ||
| * this work for additional information regarding copyright ownership. | ||
| * The ASF 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. | ||
| */ | ||
| package org.apache.solr.client.api.endpoint; | ||
|
|
||
| import io.swagger.v3.oas.annotations.Operation; | ||
| import jakarta.ws.rs.DELETE; | ||
| import jakarta.ws.rs.DefaultValue; | ||
| import jakarta.ws.rs.GET; | ||
| import jakarta.ws.rs.POST; | ||
| import jakarta.ws.rs.PUT; | ||
| import jakarta.ws.rs.Path; | ||
| import jakarta.ws.rs.PathParam; | ||
| import jakarta.ws.rs.QueryParam; | ||
| import java.util.List; | ||
| import org.apache.solr.client.api.model.FlexibleSolrJerseyResponse; | ||
| import org.apache.solr.client.api.model.SchemaDesignerCollectionsResponse; | ||
| import org.apache.solr.client.api.model.SchemaDesignerConfigsResponse; | ||
| import org.apache.solr.client.api.model.SchemaDesignerInfoResponse; | ||
| import org.apache.solr.client.api.model.SchemaDesignerPublishResponse; | ||
| import org.apache.solr.client.api.model.SchemaDesignerResponse; | ||
| import org.apache.solr.client.api.model.SchemaDesignerSchemaDiffResponse; | ||
| import org.apache.solr.client.api.model.SolrJerseyResponse; | ||
|
|
||
| /** V2 API definitions for the Solr Schema Designer. */ | ||
| @Path("/schema-designer") | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [Q] This comment aims to summarize the cosmetic changes you've made here. But that comment itself looks off somehow. Looking at the actual code here, each API has a Further the "Before" column doesn't appear to actually represent the APIs as they exist today on Was this intentional? (e.g.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm going to largely skip review of this file for now given some of the uncertainties above, but happy to review those later on. |
||
| public interface SchemaDesignerApi { | ||
|
|
||
| @GET | ||
| @Path("/{configSet}/info") | ||
| @Operation( | ||
| summary = "Get info about a configSet being designed.", | ||
| tags = {"schema-designer"}) | ||
| SchemaDesignerInfoResponse getInfo(@PathParam("configSet") String configSet) throws Exception; | ||
|
|
||
| @POST | ||
| @Path("/{configSet}/prep") | ||
| @Operation( | ||
| summary = "Prepare a mutable configSet copy for schema design.", | ||
| tags = {"schema-designer"}) | ||
| SchemaDesignerResponse prepNewSchema( | ||
| @PathParam("configSet") String configSet, @QueryParam("copyFrom") String copyFrom) | ||
| throws Exception; | ||
|
|
||
| @DELETE | ||
| @Path("/{configSet}") | ||
| @Operation( | ||
| summary = "Clean up temporary resources for a schema being designed.", | ||
| tags = {"schema-designer"}) | ||
| SolrJerseyResponse cleanupTempSchema(@PathParam("configSet") String configSet) throws Exception; | ||
|
|
||
| @PUT | ||
| @Path("/{configSet}/file") | ||
| @Operation( | ||
| summary = "Update the contents of a file in a configSet being designed.", | ||
| tags = {"schema-designer"}) | ||
| SchemaDesignerResponse updateFileContents( | ||
| @PathParam("configSet") String configSet, @QueryParam("file") String file) throws Exception; | ||
|
|
||
| @GET | ||
| @Path("/{configSet}/sample") | ||
| @Operation( | ||
| summary = "Get a sample value and analysis for a field.", | ||
| tags = {"schema-designer"}) | ||
| FlexibleSolrJerseyResponse getSampleValue( | ||
| @PathParam("configSet") String configSet, | ||
| @QueryParam("field") String fieldName, | ||
| @QueryParam("uniqueKeyField") String idField, | ||
| @QueryParam("docId") String docId) | ||
| throws Exception; | ||
|
|
||
| @GET | ||
| @Path("/{configSet}/collectionsForConfig") | ||
| @Operation( | ||
| summary = "List collections that use a given configSet.", | ||
| tags = {"schema-designer"}) | ||
| SchemaDesignerCollectionsResponse listCollectionsForConfig( | ||
| @PathParam("configSet") String configSet) throws Exception; | ||
|
|
||
| @GET | ||
| @Path("/configs") | ||
| @Operation( | ||
| summary = "List all configSets available for schema design.", | ||
| tags = {"schema-designer"}) | ||
| SchemaDesignerConfigsResponse listConfigs() throws Exception; | ||
|
|
||
| @POST | ||
| @Path("/{configSet}/add") | ||
| @Operation( | ||
| summary = "Add a new field, field type, or dynamic field to the schema being designed.", | ||
| tags = {"schema-designer"}) | ||
| SchemaDesignerResponse addSchemaObject( | ||
| @PathParam("configSet") String configSet, @QueryParam("schemaVersion") Integer schemaVersion) | ||
| throws Exception; | ||
|
|
||
| @PUT | ||
| @Path("/{configSet}/update") | ||
| @Operation( | ||
| summary = "Update an existing field or field type in the schema being designed.", | ||
| tags = {"schema-designer"}) | ||
| SchemaDesignerResponse updateSchemaObject( | ||
| @PathParam("configSet") String configSet, @QueryParam("schemaVersion") Integer schemaVersion) | ||
| throws Exception; | ||
|
|
||
| @PUT | ||
| @Path("/{configSet}/publish") | ||
| @Operation( | ||
| summary = "Publish the designed schema to a live configSet.", | ||
| tags = {"schema-designer"}) | ||
| SchemaDesignerPublishResponse publish( | ||
| @PathParam("configSet") String configSet, | ||
| @QueryParam("schemaVersion") Integer schemaVersion, | ||
| @QueryParam("newCollection") String newCollection, | ||
| @QueryParam("reloadCollections") @DefaultValue("false") Boolean reloadCollections, | ||
| @QueryParam("numShards") @DefaultValue("1") Integer numShards, | ||
| @QueryParam("replicationFactor") @DefaultValue("1") Integer replicationFactor, | ||
| @QueryParam("indexToCollection") @DefaultValue("false") Boolean indexToCollection, | ||
| @QueryParam("cleanupTemp") @DefaultValue("true") Boolean cleanupTempParam, | ||
| @QueryParam("disableDesigner") @DefaultValue("false") Boolean disableDesigner) | ||
| throws Exception; | ||
|
|
||
| @POST | ||
| @Path("/{configSet}/analyze") | ||
| @Operation( | ||
| summary = "Analyze sample documents and suggest a schema.", | ||
| tags = {"schema-designer"}) | ||
| SchemaDesignerResponse analyze( | ||
| @PathParam("configSet") String configSet, | ||
| @QueryParam("schemaVersion") Integer schemaVersion, | ||
| @QueryParam("copyFrom") String copyFrom, | ||
| @QueryParam("uniqueKeyField") String uniqueKeyField, | ||
| @QueryParam("languages") List<String> languages, | ||
| @QueryParam("enableDynamicFields") Boolean enableDynamicFields, | ||
| @QueryParam("enableFieldGuessing") Boolean enableFieldGuessing, | ||
| @QueryParam("enableNestedDocs") Boolean enableNestedDocs) | ||
| throws Exception; | ||
|
|
||
| @GET | ||
| @Path("/{configSet}/query") | ||
| @Operation( | ||
| summary = "Query the temporary collection used during schema design.", | ||
| tags = {"schema-designer"}) | ||
| FlexibleSolrJerseyResponse query(@PathParam("configSet") String configSet) throws Exception; | ||
|
|
||
| @GET | ||
| @Path("/{configSet}/diff") | ||
| @Operation( | ||
| summary = "Get the diff between the designed schema and the published schema.", | ||
| tags = {"schema-designer"}) | ||
| SchemaDesignerSchemaDiffResponse getSchemaDiff(@PathParam("configSet") String configSet) | ||
| throws Exception; | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one or more | ||
| * contributor license agreements. See the NOTICE file distributed with | ||
| * this work for additional information regarding copyright ownership. | ||
| * The ASF 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. | ||
| */ | ||
| package org.apache.solr.client.api.model; | ||
|
|
||
| import com.fasterxml.jackson.annotation.JsonProperty; | ||
|
|
||
| /** Response type for the "get configset file contents" API. */ | ||
| public class ConfigSetFileContentsResponse extends SolrJerseyResponse { | ||
|
|
||
| /** The path of the file within the configset (as requested). */ | ||
| @JsonProperty("path") | ||
| public String path; | ||
|
|
||
| /** The UTF-8 text content of the file. */ | ||
| @JsonProperty("content") | ||
| public String content; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one or more | ||
| * contributor license agreements. See the NOTICE file distributed with | ||
| * this work for additional information regarding copyright ownership. | ||
| * The ASF 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. | ||
| */ | ||
| package org.apache.solr.client.api.model; | ||
|
|
||
| import com.fasterxml.jackson.annotation.JsonProperty; | ||
| import java.util.List; | ||
|
|
||
| /** Response body for the Schema Designer list-collections-for-config endpoint. */ | ||
| public class SchemaDesignerCollectionsResponse extends SolrJerseyResponse { | ||
|
|
||
| @JsonProperty("collections") | ||
| public List<String> collections; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one or more | ||
| * contributor license agreements. See the NOTICE file distributed with | ||
| * this work for additional information regarding copyright ownership. | ||
| * The ASF 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. | ||
| */ | ||
| package org.apache.solr.client.api.model; | ||
|
|
||
| import com.fasterxml.jackson.annotation.JsonProperty; | ||
| import java.util.Map; | ||
|
|
||
| /** Response body for the Schema Designer list-configs endpoint. */ | ||
| public class SchemaDesignerConfigsResponse extends SolrJerseyResponse { | ||
|
|
||
| /** | ||
| * Map of configSet name to status: 0 = in-progress (temp only), 1 = disabled, 2 = enabled and | ||
| * published. | ||
| */ | ||
| @JsonProperty("configSets") | ||
| public Map<String, Integer> configSets; | ||
| } |
Uh oh!
There was an error while loading. Please reload this page.