Copilot commented on code in PR #4142:
URL: https://github.com/apache/solr/pull/4142#discussion_r2818047087
##########
solr/core/src/java/org/apache/solr/cli/RunExampleTool.java:
##########
@@ -403,85 +404,89 @@ protected void runExample(CommandLine cli, String
exampleName) throws Exception
SolrCLI.postJsonToSolr(
solrClient,
"/" + collectionName + "/schema",
- "{\n"
- + " \"add-field-type\" : {\n"
- + " \"name\":\"knn_vector_10\",\n"
- + " \"class\":\"solr.DenseVectorField\",\n"
- + " \"vectorDimension\":10,\n"
- + " \"similarityFunction\":cosine\n"
- + " \"knnAlgorithm\":hnsw\n"
- + " }\n"
- + " }");
+ """
+ {
+ "add-field-type" : {
+ "name":"knn_vector_10",
+ "class":"solr.DenseVectorField",
+ "vectorDimension":10,
+ "similarityFunction":cosine
+ "knnAlgorithm":hnsw
+ }
+ }""");
echo(
"Adding name, genre, directed_by, initial_release_date, and
film_vector fields to films schema");
SolrCLI.postJsonToSolr(
solrClient,
"/" + collectionName + "/schema",
- "{\n"
- + " \"add-field\" : {\n"
- + " \"name\":\"name\",\n"
- + " \"type\":\"text_general\",\n"
- + " \"multiValued\":false,\n"
- + " \"stored\":true\n"
- + " },\n"
- + " \"add-field\" : {\n"
- + " \"name\":\"genre\",\n"
- + " \"type\":\"text_general\",\n"
- + " \"multiValued\":true,\n"
- + " \"stored\":true\n"
- + " },\n"
- + " \"add-field\" : {\n"
- + " \"name\":\"directed_by\",\n"
- + " \"type\":\"text_general\",\n"
- + " \"multiValued\":true,\n"
- + " \"stored\":true\n"
- + " },\n"
- + " \"add-field\" : {\n"
- + " \"name\":\"initial_release_date\",\n"
- + " \"type\":\"pdate\",\n"
- + " \"stored\":true\n"
- + " },\n"
- + " \"add-field\" : {\n"
- + " \"name\":\"film_vector\",\n"
- + " \"type\":\"knn_vector_10\",\n"
- + " \"indexed\":true\n"
- + " \"stored\":true\n"
- + " },\n"
- + " \"add-copy-field\" : {\n"
- + " \"source\":\"genre\",\n"
- + " \"dest\":\"_text_\"\n"
- + " },\n"
- + " \"add-copy-field\" : {\n"
- + " \"source\":\"name\",\n"
- + " \"dest\":\"_text_\"\n"
- + " },\n"
- + " \"add-copy-field\" : {\n"
- + " \"source\":\"directed_by\",\n"
- + " \"dest\":\"_text_\"\n"
- + " }\n"
- + " }");
+ """
+ {
+ "add-field" : {
+ "name":"name",
+ "type":"text_general",
+ "multiValued":false,
+ "stored":true
+ },
+ "add-field" : {
+ "name":"genre",
+ "type":"text_general",
+ "multiValued":true,
+ "stored":true
+ },
+ "add-field" : {
+ "name":"directed_by",
+ "type":"text_general",
+ "multiValued":true,
+ "stored":true
+ },
+ "add-field" : {
+ "name":"initial_release_date",
+ "type":"pdate",
+ "stored":true
+ },
+ "add-field" : {
+ "name":"film_vector",
+ "type":"knn_vector_10",
+ "indexed":true
Review Comment:
The JSON schema being posted is missing a comma after the "indexed" field.
This will cause a JSON parsing error when the schema update is attempted. The
field should have a comma after its value to separate it from the "stored"
field.
```suggestion
"indexed":true,
```
##########
solr/core/src/java/org/apache/solr/cli/RunExampleTool.java:
##########
@@ -403,85 +404,89 @@ protected void runExample(CommandLine cli, String
exampleName) throws Exception
SolrCLI.postJsonToSolr(
solrClient,
"/" + collectionName + "/schema",
- "{\n"
- + " \"add-field-type\" : {\n"
- + " \"name\":\"knn_vector_10\",\n"
- + " \"class\":\"solr.DenseVectorField\",\n"
- + " \"vectorDimension\":10,\n"
- + " \"similarityFunction\":cosine\n"
- + " \"knnAlgorithm\":hnsw\n"
- + " }\n"
- + " }");
+ """
+ {
+ "add-field-type" : {
+ "name":"knn_vector_10",
+ "class":"solr.DenseVectorField",
+ "vectorDimension":10,
+ "similarityFunction":cosine
+ "knnAlgorithm":hnsw
Review Comment:
The JSON schema being posted is missing commas after the
"similarityFunction" and "knnAlgorithm" fields. This will cause a JSON parsing
error when the schema update is attempted. These fields should have commas
after their values.
```suggestion
"similarityFunction":"cosine",
"knnAlgorithm":"hnsw"
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]